[php-src] PR #21389: Fix ReflectionMethod::invoke() with internal closures
| From: | iliaal | Date: | Sun, 08 Mar 2026 22:09:37 +0000 |
| Subject: | [php-src] PR #21389: Fix ReflectionMethod::invoke() with internal closures | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35139@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21389
Author: iliaal
## Summary
Follow-up to GH-21366. The closure identity check accessed
op_array.opcodes
unconditionally, but internal closures created via first-class callable syntax (e.g.
var_dump(...)) use internal_function, not op_array. This is
undefined behavior and will crash under ASAN/debug builds.
- Check func->type == ZEND_USER_FUNCTION before accessing
op_array.opcodes
- For internal closures, compare the zend_function pointer directly
- Added test coverage for internal closure validation
Reported by @ndossche in https://github.com/php/php-src/pull/21366#discussion_r2902370004