[php-src] PR #25672: Skip pipe/array_map optimization for forbid-dynamic-calls functions
| From: | prateekbhujel | Date: | Mon, 23 Nov 2026 13:07:22 +0000 |
| Subject: | [php-src] PR #25672: Skip pipe/array_map optimization for forbid-dynamic-calls functions | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40925@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25672
Author: prateekbhujel
Follow-up to #25546 for the
extract() / compact() /
func_get_arg() case in GH-25379.
When zend_partial_apply() optimizes an FCC/PFA in array_map() or
|>, rewriting it into a direct call skips the dynamic call check so functions
flagged with ZEND_ACC2_FORBID_DYN_CALLS end up running directly in the caller's
scope instead of throwing Error: Cannot call ...() dynamically.
This checks ZEND_ACC2_FORBID_DYN_CALLS in
zend_is_pipe_optimizable_callable() (covering resolved function names, namespace
fallback to global functions, Class::method string literals, and literal static calls).
Resolving the function name there also avoids hitting the assert() assertion failure
when assert is imported under an alias like use function assert as a;.
/cc @arnaud-lb