Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- SPL: IteratorIterator foreach by reference failure --CREDITS-- Lukasz Andrzejak m..

Decoded Output download

--TEST--
SPL: IteratorIterator foreach by reference failure
--CREDITS--
Lukasz Andrzejak [email protected]
#testfest London 2009-05-09
--FILE--
<?php
$i = new ArrayIterator(array(1,1,1,1,1));
$iii = new IteratorIterator($i);
p($iii);
function p ($i) {
  foreach ($i as &$value) {}
}
?>
--EXPECTF--
Fatal error: Uncaught Error: An iterator cannot be used with foreach by reference in %s:%d
Stack trace:
#0 %s(%d): p(Object(IteratorIterator))
#1 {main}
  thrown in %s on line %d

Did this file decode correctly?

Original Code

--TEST--
SPL: IteratorIterator foreach by reference failure
--CREDITS--
Lukasz Andrzejak [email protected]
#testfest London 2009-05-09
--FILE--
<?php
$i = new ArrayIterator(array(1,1,1,1,1));
$iii = new IteratorIterator($i);
p($iii);
function p ($i) {
  foreach ($i as &$value) {}
}
?>
--EXPECTF--
Fatal error: Uncaught Error: An iterator cannot be used with foreach by reference in %s:%d
Stack trace:
#0 %s(%d): p(Object(IteratorIterator))
#1 {main}
  thrown in %s on line %d

Function Calls

None

Variables

None

Stats

MD5 dadaf6ce48e78b3e5af6c76380f44133
Eval Count 0
Decode Time 84 ms