[php-src] Issue #8421: Attributes that target functions are not valid for anonymous functions defined within a method
| From: | nikic | Date: | Thu, 21 Apr 2022 21:23:54 +0000 |
| Subject: | [php-src] Issue #8421: Attributes that target functions are not valid for anonymous functions defined within a method | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241143@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8421
Comment Author: nikic
> > Hm, the [documentation](https://www.php.net/manual/en/language.attributes.classes.php)
> > doesn't really specify this very well. Technically
$this is
> > bound in the closure which makes it more than a normal function, but it's also not a method,
> > but TARGET_METHOD currently passes. @beberlei Do you have any
> > opinions on this? Note that a static closure also only passes the
> > TARGET_METHOD check.
>
> That was what I thought initially, but attributes are relevant to their target
> structure/element, not their context.
Agree, I think closures should use TARGET_FUNCTION. It should be possible to handle
this with an additional check for ZEND_ACC_CLOSURE.