-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SIGABRT
/SIGTRAP
when using closures in attributes in PHP 8.5
#17096
Labels
Comments
|
Simple reproducer: <?php
#[Attr(static function () {
})]
function foo() {
}
$r = new ReflectionFunction('foo');
$r->getAttributes()[0]->__toString(); |
@alexandre-daubois A fix is available in PR #17120. Can you try it with Symfony / your Symfony use case? |
Just tested with your PR and it does. Thank you Tim! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
While playing with closures in attributes thanks to the last accepted RFC, the following code:
Resulted in this output (debug enabled during PHP compilation):
When debug is disabled, a SIGTRAP is thrown and PHP crashes immediately. The built-in server is used (
php-src/sapi/cli/php -S localhost:8002 -t public/
), Symfony CLI server behave the same. It crashes as soon as you go on/
.A plain Symfony project can be created, then create a controller with the above code snippet. The
callable
argument doesn't have to even exist in Symfony'sIsGranted
attribute (that's the feature I'm playing with). Even with a brand new Symfony install, this crashes.This is the most minimal snippet I could do to reproduce this. If you need any other information to help you debug/setup the reproducer, I'd be happy to help.
PHP Version
PHP 8.5.0-dev
Operating System
macOS 15.1.1
The text was updated successfully, but these errors were encountered: