]> granicus.if.org Git - php/commitdiff
Fix tests: don't count non-countables
authorChristoph M. Becker <cmbecker69@gmx.de>
Sun, 13 Nov 2016 17:16:17 +0000 (18:16 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Sun, 13 Nov 2016 17:16:17 +0000 (18:16 +0100)
ext/exif/tests/bug62523_1.phpt
ext/exif/tests/bug62523_3.phpt
ext/filter/tests/bug71063.phpt
ext/simplexml/tests/000.phpt
ext/simplexml/tests/bug35785.phpt

index 28d42f021d0730f4248b63e5bace16287d4d8478..d79b544eb0342db900de9f4b3f43ba9f147cb3e2 100644 (file)
@@ -7,12 +7,12 @@ extension_loaded("exif") or die("skip need exif");
 --FILE--
 <?php
 echo "Test\n";
-var_dump(count(exif_read_data(__DIR__."/bug62523_1.jpg")));
+var_dump(exif_read_data(__DIR__."/bug62523_1.jpg"));
 ?>
 Done
 --EXPECTF--
 Test
 
 Warning: exif_read_data(bug62523_1.jpg): File not supported in %sbug62523_1.php on line %d
-int(1)
+bool(false)
 Done
index 6e11354c5a725a67bbe153d3ffa8aad77ae4a736..c94872a3bfa84644a3fbf6c73a991dcc3fa08ba2 100644 (file)
@@ -7,12 +7,12 @@ extension_loaded("exif") or die("skip need exif");
 --FILE--
 <?php
 echo "Test\n";
-var_dump(count(exif_read_data(__DIR__."/bug62523_3.jpg")));
+var_dump(exif_read_data(__DIR__."/bug62523_3.jpg"));
 ?>
 Done
 --EXPECTF--
 Test
 
 Warning: exif_read_data(bug62523_3.jpg): File not supported in %sbug62523_3.php on line %d
-int(1)
+bool(false)
 Done
index 30e8d7d145e90c052bb50ae4b0a029bc093da282..60c6a67cb909b17669ce7570adba2476551ad50a 100644 (file)
@@ -8,9 +8,9 @@ PATH=/
 variables_order=E
 --FILE--
 <?php
-var_dump(count($_ENV['PATH']) > 0);
-var_dump(count(filter_input(INPUT_ENV, 'PATH')) > 0);
+var_dump($_ENV['PATH']);
+var_dump(filter_input(INPUT_ENV, 'PATH'));
 ?>
 --EXPECT--
-bool(true)
-bool(true)
+string(1) "/"
+string(1) "/"
index 51dbe3b5eca50f286005b59fdae83fa9a8285584..ae23dcfdd01e2334c8d5e1c83f12596753c268bf 100644 (file)
@@ -13,7 +13,7 @@ function test($what)
        echo "===$what\n";
        eval("var_dump(isset(\$$what));");
        eval("var_dump((bool)\$$what);");
-       eval("var_dump(count(\$$what));");
+       eval("if (isset(\$$what)) var_dump(count(\$$what));");
        eval("var_dump(\$$what);");
 }
 
@@ -168,7 +168,6 @@ object(SimpleXMLElement)#%d (2) {
 ===sxe->elem1[0]->elem2->bla
 bool(false)
 bool(false)
-int(0)
 object(SimpleXMLElement)#%d (0) {
 }
 ===sxe->elem1[0]["attr1"]
@@ -182,7 +181,6 @@ object(SimpleXMLElement)#%d (1) {
 ===sxe->elem1[0]->attr1
 bool(false)
 bool(false)
-int(0)
 object(SimpleXMLElement)#%d (0) {
 }
 ===sxe->elem1[1]
@@ -201,7 +199,6 @@ object(SimpleXMLElement)#%d (1) {
 ===sxe->elem1[2]
 bool(false)
 bool(false)
-int(0)
 NULL
 ===sxe->elem11
 bool(true)
@@ -233,22 +230,18 @@ object(SimpleXMLElement)#%d (0) {
 ===sxe->elem22
 bool(false)
 bool(false)
-int(0)
 object(SimpleXMLElement)#%d (0) {
 }
 ===sxe->elem22->elem222
 bool(false)
 bool(false)
-int(0)
 NULL
 ===sxe->elem22->attr22
 bool(false)
 bool(false)
-int(0)
 NULL
 ===sxe->elem22["attr22"]
 bool(false)
 bool(false)
-int(0)
 NULL
 ===DONE===
index 0e03f07c55c226a029a0a273bb8c6e5eed6dcd06..080a510837a3624de12417782a308c8379edc583 100644 (file)
@@ -9,9 +9,8 @@ $xml = simplexml_load_string("<root></root>");
 $xml->bla->posts->name = "FooBar";
 echo $xml->asXML();
 $xml = simplexml_load_string("<root></root>");
-$count = count($xml->bla->posts);
-var_dump($count);
-$xml->bla->posts[$count]->name = "FooBar";
+var_dump(isset($xml->bla->posts));
+$xml->bla->posts[0]->name = "FooBar";
 echo $xml->asXML();
 $xml = simplexml_load_string("<root></root>");
 $xml->bla->posts[]->name = "FooBar";
@@ -22,7 +21,7 @@ echo $xml->asXML();
 --EXPECTF--
 <?xml version="1.0"?>
 <root><bla><posts><name>FooBar</name></posts></bla></root>
-int(0)
+bool(false)
 <?xml version="1.0"?>
 <root><bla><posts><name>FooBar</name></posts></bla></root>
 <?xml version="1.0"?>