From: Craig Duncan Date: Sat, 17 Feb 2018 22:38:55 +0000 (+0000) Subject: Add a test for iterating SXE properties by reference X-Git-Tag: php-7.3.0alpha1~332 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9439dd0b5b1cbd033bc3bdd7b2215801d4ec9978;p=php Add a test for iterating SXE properties by reference --- diff --git a/ext/simplexml/tests/foreach_by_reference.phpt b/ext/simplexml/tests/foreach_by_reference.phpt new file mode 100644 index 0000000000..070a3cf2cd --- /dev/null +++ b/ext/simplexml/tests/foreach_by_reference.phpt @@ -0,0 +1,24 @@ +--TEST-- +SimpleXml: foreach by reference +--SKIPIF-- + +--FILE-- + + Lucy + Mikasa + +XML; + +$people = simplexml_load_string($xml); + +foreach ($people as &$person) {} + +?> +--EXPECTF-- +Fatal error: Uncaught Error: An iterator cannot be used with foreach by reference in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d