Category
bug · php-src-strict · Reflection + named args · ext/intl/collator
Problem
Collator::getSortKey is registered with the procedural parameter list ($coll, $str) on the instance method. Zend’s OOP stub is getSortKey(string $string): string|false. Runtime one-arg calls work, but Reflection and named args diverge.
Probed 2026-08-07 on master @4c2f13ea09 under PHP_COMPILER_PROFILE=8.4.
| Repro |
Zend 8.4 |
VM PROFILE=8.4 (2026-08-07) |
| Reflection params |
string $string |
collator $coll, string $str |
| return type |
string|false |
none |
$c->getSortKey('abc') |
string |
string (ok) |
$c->getSortKey(string: 'abc') |
string |
TypeError / internal coerce fail (named str only matches Reflection) |
php-src reference
PHP implementation target
ext/intl/ Collator method registration / Reflection metadata — align OOP arginfo with Zend stub; keep procedural collator_get_sort_key separate
- PHP-in-PHP only; no new
runtime/*.c logic
Repro
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php bin/vm.php -r '"'"'
$r = new ReflectionMethod(Collator::class, "getSortKey");
foreach ($r->getParameters() as $p) {
echo $p->getName(), " ", ($p->hasType() ? (string)$p->getType() : "none"), "\n";
}
echo "ret=", $r->hasReturnType() ? (string)$r->getReturnType() : "none", "\n";
$c = new Collator("en_US");
var_export($c->getSortKey(string: "abc"));
'"'"''
Done when
Category
bug· php-src-strict · Reflection + named args · ext/intl/collatorProblem
Collator::getSortKeyis registered with the procedural parameter list ($coll,$str) on the instance method. Zend’s OOP stub isgetSortKey(string $string): string|false. Runtime one-arg calls work, but Reflection and named args diverge.Probed 2026-08-07 on master
@4c2f13ea09underPHP_COMPILER_PROFILE=8.4.string $stringcollator $coll,string $strstring|false$c->getSortKey('abc')$c->getSortKey(string: 'abc')stronly matches Reflection)php-src reference
ext/intl/collator/collator.stub.php—public function getSortKey(string $string): string|falsePHP implementation target
ext/intl/Collator method registration / Reflection metadata — align OOP arginfo with Zend stub; keep proceduralcollator_get_sort_keyseparateruntime/*.clogicRepro
Done when
getSortKey(string $string): string|falsestring:works; phantom$collparam gone from instance method