Skip to content

Instantly share code, notes, and snippets.

@andriesss andriesss/73209.php Secret
Created Feb 8, 2018

Embed
What would you like to do?
<?php
class Foo
{
public $date;
}
$foo = new Foo;
$foo->date = new DateTime;
$data = [$foo];
$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($data));
foreach ($iterator as $key => $value) {}
// works in php 7.1.13
// cat script.php | docker run -i --rm php:7.1.13-cli php
// fails in php 7.1.14
// Fatal error: Uncaught InvalidArgumentException: Overloaded object of type DateTime is not compatible with RecursiveArrayIterator in -:14
// Stack trace:
// #0 [internal function]: ArrayIterator->__construct(Object(DateTime), 0)
// #1 -(14): RecursiveArrayIterator->getChildren()
// #2 {main}
// thrown in - on line 14
// cat script.php | docker run -i --rm php:7.1.14-cli php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.