summaryrefslogtreecommitdiff
path: root/ext/simplexml
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-07-10 10:57:02 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-07-10 11:09:47 +0200
commita207b3574b5015877de997757cdd08a54ffb9e98 (patch)
tree76f709d2812b107b0661c413916e1c312ef53bc0 /ext/simplexml
parent9d82a01d017bafd9896d26f6291b443c9cd7f0ec (diff)
downloadphp-git-a207b3574b5015877de997757cdd08a54ffb9e98.tar.gz
Fix iteration limits in SXE test
Test doesn't look like it's specifically testing out of bounds access, just two different iteration patterns, so make sure the limits are correct.
Diffstat (limited to 'ext/simplexml')
-rw-r--r--ext/simplexml/tests/017.phpt21
1 files changed, 6 insertions, 15 deletions
diff --git a/ext/simplexml/tests/017.phpt b/ext/simplexml/tests/017.phpt
index ba42ac46a9..42d6e3eccc 100644
--- a/ext/simplexml/tests/017.phpt
+++ b/ext/simplexml/tests/017.phpt
@@ -34,12 +34,11 @@ function print_xml($xml) {
}
function print_xml2($xml) {
- $persons = 2;
- for ($i=0;$i<$persons;$i++) {
- echo "person: ".$xml->person[$i]['name']."\n";
- $children = 2;
- for ($j=0;$j<$children;$j++) {
- echo " child: ".$xml->person[$i]->child[$j]['name']."\n";
+ for ($i=0;$i<count($xml->person);$i++) {
+ $person = $xml->person[$i];
+ echo "person: ".$person['name']."\n";
+ for ($j=0;$j<count($person->child);$j++) {
+ echo " child: ".$person->child[$j]['name']."\n";
}
}
}
@@ -54,7 +53,7 @@ echo "---22---\n";
print_xml2(simplexml_load_string($xml1));
?>
===DONE===
---EXPECTF--
+--EXPECT--
---11---
person: Joe
child: Ann
@@ -75,12 +74,4 @@ person: Boe
---22---
person: Joe
child: Ann
- child:
-person:
-
-Notice: Trying to get property 'child' of non-object in %s017.php on line %d
- child:
-
-Notice: Trying to get property 'child' of non-object in %s017.php on line %d
- child:
===DONE===