From 75ef658d8f6f3f54927bf146f519b625c33f14e8 Mon Sep 17 00:00:00 2001 From: Kevin Date: Wed, 29 Aug 2018 07:27:53 +0800 Subject: [PATCH] Fix metar parsing issue --- app/Support/Metar.php | 2 +- tests/MetarTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Support/Metar.php b/app/Support/Metar.php index 7f48043a..2d38be5a 100644 --- a/app/Support/Metar.php +++ b/app/Support/Metar.php @@ -993,7 +993,7 @@ class Metar implements \ArrayAccess $observed['amount'] = $found[2]; } } // Cloud cover observed - elseif (isset($found[5]) && !empty($found[5])) { + elseif (isset($found[5]) && !empty($found[5]) && is_numeric($found[5])) { $observed['height'] = new Altitude($found[5] * 100, 'feet'); // Cloud height diff --git a/tests/MetarTest.php b/tests/MetarTest.php index 00c191f0..a947a7cb 100644 --- a/tests/MetarTest.php +++ b/tests/MetarTest.php @@ -82,6 +82,8 @@ class MetarTest extends TestCase { $metar = 'EGLL 261250Z AUTO 17014KT 8000 -RA BKN010/// ' .'BKN016/// OVC040/// //////TCU 13/12 Q1008 TEMPO 4000 RA'; + + $parsed = Metar::parse($metar); } public function testMetarTrends()