<?php
class x extends RecursiveRegexIterator{}
$arr = new RecursiveArrayIterator([0,[1,2]]);
$x = new x($arr, '/.*/');
var_dump(get_class($x->getChildren()));
Fatal error: Uncaught TypeError: ArrayIterator::__construct(): Argument #1 ($array) must be of type array, int given in /in/MXfdX:7
Stack trace:
#0 [internal function]: ArrayIterator->__construct(0, 0)
#1 [internal function]: RecursiveArrayIterator->getChildren()
#2 /in/MXfdX(7): RecursiveRegexIterator->getChildren()
#3 {main}
thrown in /in/MXfdX on line 7
Process exited with code 255.
Fatal error: Uncaught InvalidArgumentException: Passed variable is not an array or object in /in/MXfdX:7
Stack trace:
#0 [internal function]: ArrayIterator->__construct(0, 0)
#1 [internal function]: RecursiveArrayIterator->getChildren()
#2 /in/MXfdX(7): RecursiveRegexIterator->getChildren()
#3 {main}
thrown in /in/MXfdX on line 7
Process exited with code 255.
Output for 7.0.0 - 7.0.17, 7.1.0 - 7.1.3
Fatal error: Uncaught InvalidArgumentException: Passed variable is not an array or object, using empty array instead in /in/MXfdX:7
Stack trace:
#0 [internal function]: ArrayIterator->__construct(0, 0)
#1 [internal function]: RecursiveArrayIterator->getChildren()
#2 /in/MXfdX(7): RecursiveRegexIterator->getChildren()
#3 {main}
thrown in /in/MXfdX on line 7
Process exited with code 255.
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Passed variable is not an array or object, using empty array instead' in /in/MXfdX:7
Stack trace:
#0 [internal function]: ArrayIterator->__construct(0, 67108864)
#1 [internal function]: RecursiveArrayIterator->getChildren()
#2 /in/MXfdX(7): RecursiveRegexIterator->getChildren()
#3 {main}
thrown in /in/MXfdX on line 7
Process exited with code 255.