From a207b3574b5015877de997757cdd08a54ffb9e98 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 10 Jul 2019 10:57:02 +0200 Subject: 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. --- ext/simplexml/tests/017.phpt | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'ext/simplexml') 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;$iperson);$i++) { + $person = $xml->person[$i]; + echo "person: ".$person['name']."\n"; + for ($j=0;$jchild);$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=== -- cgit v1.2.1