Skip to content

Regression: Collator::getSortKey Reflection (collator $coll, string $str) — Zend string $string → string|false; named string rejected (ext/intl/collator) #28785

Description

@PurHur

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

  • Reflection reports getSortKey(string $string): string|false
  • Named arg string: works; phantom $coll param gone from instance method
  • Compliance / repro guard; php-src-strict

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions