Closed
Description
Description
The following code:
<?php
declare(ticks=1);
register_tick_function(function(){
if(Fiber::getCurrent() !== null) {
Fiber::suspend();
}
});
for($i = 3; $i--;)
{
$fibers[$i] = new fiber(function (){
echo "1\n";
echo "2\n";
echo "3\n";
});
$fibers[$i]->start();
}
Resulted in this output:
1
1
2
3
1
2
3
But I expected this output instead:
1
1
1
Explanation:
If we are inside a fiber, after each tick, the tick function should call Fiber::suspend().
But currently this tick function only works inside first Fiber.
PHP Version
PHP 8.1.8
Operating System
macOS