diff --git a/toml-test/debug.php b/toml-test/debug.php index 0e1932d..6270cde 100644 --- a/toml-test/debug.php +++ b/toml-test/debug.php @@ -2,7 +2,7 @@ require('../src/Toml.php'); -$toml = '[naughty..naughty]'; +$toml = 'thevoid = [[[[[]]]]]'; $result = Toml::parse($toml); @@ -14,7 +14,7 @@ function walk(&$a) { foreach($a as $i => $v) { - if(is_array($v)) + if(is_array($v) && array_values($v) !== $v) { walk($a[$i]); } @@ -38,17 +38,22 @@ function walk(&$a) { $t = 'integer'; } + // Parse array type + if($t == 'array') + { + walk($v); + } + else + { + $v = "$v"; + } + $a[$i] = array( 'type' => $t, - 'value' => "$v", + 'value' => $v, ); } } - - if(empty($a)) - { - $a = new stdClass(); - } } walk($result); diff --git a/toml-test/test.php b/toml-test/test.php index f1b2863..55468cd 100755 --- a/toml-test/test.php +++ b/toml-test/test.php @@ -15,7 +15,7 @@ function walk(&$a) { foreach($a as $i => $v) { - if(is_array($v)) + if(is_array($v) && array_values($v) !== $v) { walk($a[$i]); } @@ -39,17 +39,22 @@ function walk(&$a) { $t = 'integer'; } + // Parse array type + if($t == 'array') + { + walk($v); + } + else + { + $v = "$v"; + } + $a[$i] = array( 'type' => $t, - 'value' => "$v", + 'value' => $v, ); } } - - if(empty($a)) - { - $a = new stdClass(); - } } walk($result);