From 7bab4cd4b92f281021bdc6e3fa2312c64ee7f5a1 Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Wed, 23 May 2018 16:45:04 -0500 Subject: [PATCH] Fix issue #21. (int)"is" is equal to zero Faulty condition check only checks for string values. In some cases, `$skey` is integer 0, and PHP converts the string `"is"` to integer 0 to do an integer conversion, causing this `if` check to fail. Following code then dies due to faulty values used for offset. --- inc/raml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/raml.php b/inc/raml.php index 5ddfb0b..1bdd5fd 100644 --- a/inc/raml.php +++ b/inc/raml.php @@ -157,7 +157,7 @@ public function generatePathData($key, $value) { $this->paths[$key]->addChild($this->formatParentPath($key) . $skey, $skey); $this->generatePathData($this->formatParentPath($key) . $skey, $svalue); unset($value[$skey]); - } elseif ($skey == 'is') { + } elseif ($skey === 'is') { if (is_array($svalue)) { foreach($svalue as $ivalue) { if (!isset($value[$ivalue])) {