Skip to content

Commit 1ccada3

Browse files
committed
Fix tests: don't count non-countables
1 parent 5a4bad7 commit 1ccada3

File tree

5 files changed

+12
-20
lines changed

5 files changed

+12
-20
lines changed

ext/exif/tests/bug62523_1.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ extension_loaded("exif") or die("skip need exif");
77
--FILE--
88
<?php
99
echo "Test\n";
10-
var_dump(count(exif_read_data(__DIR__."/bug62523_1.jpg")));
10+
var_dump(exif_read_data(__DIR__."/bug62523_1.jpg"));
1111
?>
1212
Done
1313
--EXPECTF--
1414
Test
1515

1616
Warning: exif_read_data(bug62523_1.jpg): File not supported in %sbug62523_1.php on line %d
17-
int(1)
17+
bool(false)
1818
Done

ext/exif/tests/bug62523_3.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ extension_loaded("exif") or die("skip need exif");
77
--FILE--
88
<?php
99
echo "Test\n";
10-
var_dump(count(exif_read_data(__DIR__."/bug62523_3.jpg")));
10+
var_dump(exif_read_data(__DIR__."/bug62523_3.jpg"));
1111
?>
1212
Done
1313
--EXPECTF--
1414
Test
1515

1616
Warning: exif_read_data(bug62523_3.jpg): File not supported in %sbug62523_3.php on line %d
17-
int(1)
17+
bool(false)
1818
Done

ext/filter/tests/bug71063.phpt

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ PATH=/
88
variables_order=E
99
--FILE--
1010
<?php
11-
var_dump(count($_ENV['PATH']) > 0);
12-
var_dump(count(filter_input(INPUT_ENV, 'PATH')) > 0);
11+
var_dump($_ENV['PATH']);
12+
var_dump(filter_input(INPUT_ENV, 'PATH'));
1313
?>
1414
--EXPECT--
15-
bool(true)
16-
bool(true)
15+
string(1) "/"
16+
string(1) "/"

ext/simplexml/tests/000.phpt

+1-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function test($what)
1313
echo "===$what\n";
1414
eval("var_dump(isset(\$$what));");
1515
eval("var_dump((bool)\$$what);");
16-
eval("var_dump(count(\$$what));");
16+
eval("if (isset(\$$what)) var_dump(count(\$$what));");
1717
eval("var_dump(\$$what);");
1818
}
1919

@@ -168,7 +168,6 @@ object(SimpleXMLElement)#%d (2) {
168168
===sxe->elem1[0]->elem2->bla
169169
bool(false)
170170
bool(false)
171-
int(0)
172171
object(SimpleXMLElement)#%d (0) {
173172
}
174173
===sxe->elem1[0]["attr1"]
@@ -182,7 +181,6 @@ object(SimpleXMLElement)#%d (1) {
182181
===sxe->elem1[0]->attr1
183182
bool(false)
184183
bool(false)
185-
int(0)
186184
object(SimpleXMLElement)#%d (0) {
187185
}
188186
===sxe->elem1[1]
@@ -201,7 +199,6 @@ object(SimpleXMLElement)#%d (1) {
201199
===sxe->elem1[2]
202200
bool(false)
203201
bool(false)
204-
int(0)
205202
NULL
206203
===sxe->elem11
207204
bool(true)
@@ -233,22 +230,18 @@ object(SimpleXMLElement)#%d (0) {
233230
===sxe->elem22
234231
bool(false)
235232
bool(false)
236-
int(0)
237233
object(SimpleXMLElement)#%d (0) {
238234
}
239235
===sxe->elem22->elem222
240236
bool(false)
241237
bool(false)
242-
int(0)
243238
NULL
244239
===sxe->elem22->attr22
245240
bool(false)
246241
bool(false)
247-
int(0)
248242
NULL
249243
===sxe->elem22["attr22"]
250244
bool(false)
251245
bool(false)
252-
int(0)
253246
NULL
254247
===DONE===

ext/simplexml/tests/bug35785.phpt

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ $xml = simplexml_load_string("<root></root>");
99
$xml->bla->posts->name = "FooBar";
1010
echo $xml->asXML();
1111
$xml = simplexml_load_string("<root></root>");
12-
$count = count($xml->bla->posts);
13-
var_dump($count);
14-
$xml->bla->posts[$count]->name = "FooBar";
12+
var_dump(isset($xml->bla->posts));
13+
$xml->bla->posts[0]->name = "FooBar";
1514
echo $xml->asXML();
1615
$xml = simplexml_load_string("<root></root>");
1716
$xml->bla->posts[]->name = "FooBar";
@@ -22,7 +21,7 @@ echo $xml->asXML();
2221
--EXPECTF--
2322
<?xml version="1.0"?>
2423
<root><bla><posts><name>FooBar</name></posts></bla></root>
25-
int(0)
24+
bool(false)
2625
<?xml version="1.0"?>
2726
<root><bla><posts><name>FooBar</name></posts></bla></root>
2827
<?xml version="1.0"?>

0 commit comments

Comments
 (0)