Category
bug · php-src-strict · Reflection / named args · stdlib
Problem
constant() / defined() advertise pre-stub parameter names, so Zend stub names are rejected.
Verified 2026-07-26 (host Zend 8.2 vs php bin/vm.php):
| Repro |
Zend 8.2+ |
VM (2026-07-26) |
constant(name:"K") after define("K",1) |
1 |
Error: Unknown named parameter $name |
defined(constant_name:"K") |
true |
Error: Unknown named parameter $constant_name |
Reflection constant |
name |
const_name |
Reflection defined |
constant_name |
name |
php-src reference
PHP implementation target
lib/BuiltinParamNames.php — forFunction('constant') → ['name']; forFunction('defined') → ['constant_name']
- Reflection metadata + named-arg dispatch for both builtins
- No new C in
runtime/
Repro
./script/docker-exec.sh -- bash -lc 'php -r '\''define("K",1); echo constant(name:"K");'\''; php bin/vm.php -r '\''define("K",1); echo constant(name:"K");'\'
'
Done when
Category
bug· php-src-strict · Reflection / named args · stdlibProblem
constant()/defined()advertise pre-stub parameter names, so Zend stub names are rejected.Verified 2026-07-26 (host Zend 8.2 vs
php bin/vm.php):constant(name:"K")afterdefine("K",1)1Error: Unknown named parameter $namedefined(constant_name:"K")trueError: Unknown named parameter $constant_nameconstantnameconst_namedefinedconstant_namenamephp-src reference
Zend/zend_builtin_functions.stub.php—constant/definedPHP implementation target
lib/BuiltinParamNames.php—forFunction('constant')→['name'];forFunction('defined')→['constant_name']runtime/Repro
Done when
name/constant_namework on VM matching Zend.phptundertest/compliance/cases/