Skip to content

Regression: constant/defined Reflection names const_name/name — Zend name/constant_name; named args rejected (Zend/zend_builtin_functions.stub.php) #23434

Description

@PurHur

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.phpforFunction('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

  • Named name / constant_name work on VM matching Zend
  • Reflection param names match php-src stubs for both
  • Compliance .phpt under test/compliance/cases/
  • php-src-strict; no php-compiler-strict shortcut

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