[GIT-PULLS] [php-src] PR #22789: Check partial-application bound arguments in the creating scope

[email protected] (iliaal) Fri, 17 Jul 2026 15:00:03 +0000
Newsgroups php.git-pulls
Message-ID <[email protected]>
Pull Request: https://github.com/php/php-src/pull/22789
Author: iliaal

The bound-argument type check in zp_bind() resolved strict_types from ZEND_ARG_USES_STRICT_TYPES(), which reads the caller of the frame creating the partial rather than the file where the partial is written. So the same f("3", ?) under strict_types=1 threw when written inside a function but silently coerced at top level, and the resulting TypeError named the enclosing function rather than the target. This passes the creating frame's strict_types into the check via ZEND_FLF_ARG_USES_STRICT_TYPES and attributes the error to the target function with zend_argument_type_error_ex.

This makes the existing eager creation-time check coherent; it does not change whether bound arguments are checked eagerly. The RFC leaves creation-time bound-argument type-check semantics unspecified, so both the eager timing (a partial throws at construction, unlike the equivalent literal closure) and these choices (creating-scope strict_types, error attributed to the target) are proposals for confirmation.