-
-
Notifications
You must be signed in to change notification settings - Fork 220
Closed
Description
Version: 2.10.10
Bug Description
Starting from PHP 8.4 it's possible to call new ReflectionGenerator($generator) on a closed generator (before 8.4 it throws a ReflectionException which is what Tracy relies on in BlueScreen::findGeneratorsAndFibers). This leads to an unexpected ReflectionException in section-stack-generator.phtml ($ref->getTrace(): it fails if the generator is closed).
Here is an example of the changed behavior.
Steps To Reproduce
Run the following code with PHP 8.4:
$generator = (function (): iterable {
yield 5;
throw new \Exception(sprintf('%f', microtime(true)));
})();
$fn = function ($generator) {
foreach ($generator as $value) {
}
};
try {
$fn($generator);
} catch (Exception $e) {
echo "exception\n";
$file = sys_get_temp_dir() . '/' . uniqid('bluescreen_');
\Tracy\Debugger::getBlueScreen()->renderToFile($e, $file);
}
echo "OK\n";Expected Behavior
Closed generators should be excluded the same way as they were before PHP 8.4.
Possible Solution
Check ReflectionGenerator::isClosed in findGeneratorsAndFibers.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels