1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Add a test for iterating SXE properties by reference

This commit is contained in:
Craig Duncan
2018-02-17 22:38:55 +00:00
committed by Nikita Popov
parent ede663f381
commit 9439dd0b5b

View File

@@ -0,0 +1,24 @@
--TEST--
SimpleXml: foreach by reference
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
$xml = <<<XML
<people>
<person>Lucy</person>
<person>Mikasa</person>
</people>
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