Bug #73471 [Ver->Asn]: PHP freezes with AppendIterator

From: Date: Mon, 01 May 2017 05:47:55 +0000
Subject: Bug #73471 [Ver->Asn]: PHP freezes with AppendIterator
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208880@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73471&edit=1

 ID:                 73471
 Updated by:         jhdxr@php.net
 Reported by:        saschaprolic at googlemail dot com
 Summary:            PHP freezes with AppendIterator
-Status:             Verified
+Status:             Assigned
 Type:               Bug
 Package:            SPL related
 Operating System:   Linux 4.4.0-43-generic Ubuntu
 PHP Version:        5.6
 Assigned To:        jhdxr
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2016-11-13 07:13:38] krakjoe@php.net

Changed version, so far as I can see, this has been a bug since 5.2 ...

------------------------------------------------------------------------
[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.

------------------------------------------------------------------------


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


Thread (11 messages)

« previous php.bugs (#208880) next »