Edit report at https://bugs.php.net/bug.php?id=73471&edit=1
ID: 73471
Updated by: requinix@php.net
Reported by: saschaprolic at googlemail dot com
Summary: PHP freezes with AppendIterator
-Status: Open
+Status: Verified
Type: Bug
Package: SPL related
Operating System: Linux 4.4.0-43-generic Ubuntu
PHP Version: 7.1.0RC5
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2016-11-08 10:47:24] hello at bweston dot me
Narrowed it down to this while loop.
https://github.com/php/php-src/blob/PHP-7.1.0RC3/ext/spl/spl_iterators.c#L3379
------------------------------------------------------------------------
[2016-11-08 10:21:24] saschaprolic at googlemail dot com
This bug is also there in PHP 5.6 and 7.0!
See also this test-script:
<?php
$iterator1 = new \AppendIterator();
$iterator2 = new \AppendIterator();
$events = new \ArrayIterator(['event']);
$iterator1->append($events);
$iterator2->append($events);
// without this foreach, i will not hang
foreach ($iterator2 as $event) {
}
$iterator1->append(new \ArrayIterator());
------------------------------------------------------------------------
[2016-11-08 10:03:59] saschaprolic at googlemail dot com
Here is the shortest script to reproduce the issue.
<?php
$iterator1 = new \AppendIterator();
$iterator2 = new \AppendIterator();
$events = new \ArrayIterator(['event']);
$iterator1->append($events);
$iterator2->append($events);
// without this foreach, i will not hang
foreach ($iterator2 as $event) {
}
$events = new \ArrayIterator(['event']);
$iterator1->append($events);
$iterator2->append($events);
------------------------------------------------------------------------
[2016-11-07 13:22:52] saschaprolic at googlemail dot com
I tried to create an isolated test script where you don't need to clone the event-store
repository, and run the phpunit tests yourself. Unfortunately I was not successful so far. But I
gave you the required links, so you actually are able to reproduce this issue, it's just a
little more work than running a simple 20 line test-script.
PHP hangs forever exactly at this line:
https://github.com/prooph/event-store/pull/210/commits/61465535e6acc657c80a1bab7ab909470cf579e8#diff-cded286a30dea4e80fa00f01cfa1a8fbL73
It does not crash, so maybe it's an infinite loop, but not in the userland code, but in PHP
itself.
------------------------------------------------------------------------
[2016-11-07 08:23:15] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
"Freezes"? Could it be an infinite loop somewhere? Use a debugger to find out exactly
where and when the problem is.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=73471
--
Edit this bug report at https://bugs.php.net/bug.php?id=73471&edit=1