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:
committed by
Nikita Popov
parent
ede663f381
commit
9439dd0b5b
24
ext/simplexml/tests/foreach_by_reference.phpt
Normal file
24
ext/simplexml/tests/foreach_by_reference.phpt
Normal 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
|
||||
Reference in New Issue
Block a user