php-src/ext/spl/tests/bug54281.phpt
Gustavo André dos Santos Lopes c2fe893985 - Fixed bug #54384: Several SPL classes crash when parent constructor is
not called.
#Merge to 5.3 pending (slight BC break on AppendIterator, as it's no
#longer possible to defer the call to the parent constructor until
#after the constructor is performed).
#Bugs fixed in an atypical way for SPL. The parent constructor call
#check is performed at construction time by using a wrapper constructor
#instead of a check on the beginning of each instance method.
#Perhaps this should be uniformized in trunk; this method was mainly
#applied only to the ones crashing, except a few iterators (at least
#AppendIterator and RecursiveIteratorIterator).
2011-03-27 04:21:06 +00:00

20 lines
676 B
PHP

--TEST--
Bug #54281 (Crash in spl_recursive_it_rewind_ex)
--FILE--
<?php
class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator {
function __construct($it, $max_depth) { }
}
$it = new RecursiveArrayIteratorIterator(new RecursiveArrayIterator(array()), 2);
foreach($it as $k=>$v) { }
?>
--EXPECTF--
Fatal error: Uncaught exception 'LogicException' with message 'In the constructor of RecursiveArrayIteratorIterator, parent::__construct() must be called and its exceptions cannot be cleared' in %s:%d
Stack trace:
#0 %s(%d): RecursiveArrayIteratorIterator->internal_construction_wrapper(Object(RecursiveArrayIterator), 2)
#1 {main}
thrown in %s on line %d