The below script will execute without error if debugger is not configured in php.ini. It will also execute without error with debugger configured for the first time $a1->test() is called but causes the following segfault on the second call to $a2->test(). This occurs both when debugging with PhpED IDE or executing by Apache. I am running PHP 7.4.7 on Centos 7.8.2003 with PhpED Professional 19.2 Build 19214 64 bit. Can someone try executing it to see if you get the same results? Anyone know whether it is fixed for the new 19.3? If so, is it possible to upgrade the debugger without upgrading the IDE? If not fixed, what is the process of reporting a bug? Thanks
EDIT. Appears to only happen if the MultipleIterator is fed a generator and I do not experience the same issues when giving it ArrayIterators. Unfortunately, I don't wish to give it an ArrayIterator.
kernel: php-fpm[29788]: segfault at 7f51ad5e4120 ip 0000565042e87fcd sp 00007ffe5e56f048 error 4 in php-fpm[565042b67000+471000]
<?php
ini_set('display_errors', 1);
class A
{
public function test()
{
$iterator = new \MultipleIterator(\MultipleIterator::MIT_NEED_ALL|\MultipleIterator::MIT_KEYS_ASSOC);
$iterator1 = $this->getIterator(1);
$iterator2 = $this->getIterator(2);
$iterator->attachIterator($iterator1, 'iterator1');
$iterator->attachIterator($iterator2, 'iterator2');
$values = [];
foreach($iterator as $v) {
$values[] = $v['iterator2'] - $v['iterator1'];
}
return $values;
}
public function getIterator($x)
{
for($index=0; $index < 10; $index++) {
yield $x*$index;
}
}
}
$a1 = new A();
$o1=$a1->test();
print_r($o1);
//Second pass causes segfault
$a2 = new A();
$o2=$a2->test();
print_r($o2); |