Description
The following code hangs in after testing out 8.5. Narrowed it down to an earlier version 8.4.7 in which this behavior first occurs. In 8.4.6 is works with no issues. Seems only to apply in Windows. In non-windows it seems to run fine: https://3v4l.org/eRYIJ#v8.4.7
<?php
class ArrayMap implements \Iterator
{
public function __construct(private array $array)
{
}
public function current(): mixed
{
return current($this->array);
}
public function next(): void
{
next($this->array);
}
public function key(): int|string|null
{
return key($this->array);
}
public function valid(): bool
{
return key($this->array) !== null;
}
public function rewind(): void
{
reset($this->array);
}
}
class Aggregate implements \IteratorAggregate
{
public function __construct(private array $array)
{
}
public function getIterator(): Traversable
{
return new ArrayMap($this->array);
}
}
class Y
{
}
class Z
{
}
$_1 = new Aggregate([Z::class => Z::class,]);
var_dump(1);
$_2 = [...iterator_to_array($_1, true)];
var_dump(2);
$_3 = [...$_2, Y::class => Z::class];
var_dump(3);
$_4 = new Aggregate($_3);
var_dump(4);
[...$_4];
var_dump(5);
Resulted in this output:
int(1)
int(2)
int(3)
int(4)
it hangs here with max cpu
But I expected this output instead:
int(1)
int(2)
int(3)
int(4)
int(5)
PHP Version
PHP 8.4.7 (cli) (built: May 6 2025 14:14:22) (NTS Visual C++ 2022 x64)
Copyright (c) The PHP Group
Zend Engine v4.4.7, Copyright (c) Zend Technologies
Operating System
Windows
Description
The following code hangs in after testing out 8.5. Narrowed it down to an earlier version 8.4.7 in which this behavior first occurs. In 8.4.6 is works with no issues. Seems only to apply in Windows. In non-windows it seems to run fine: https://3v4l.org/eRYIJ#v8.4.7
Resulted in this output:
But I expected this output instead:
PHP Version
Operating System
Windows