Skip to content

[PHP 8.3] constants have their namespace lowercased #11423

Closed
@ju1ius

Description

@ju1ius

Description

The following code:

const char* name = "Foo\\Bar\\BAZ";
zend_register_long_constant(name, strlen(name), 42, CONST_CS|CONST_PERSISTENT, module_number);
$re = new \ReflectionExtension('my_extension');
var_dump($re->getConstants());

Resulted in this output:

array(1) {
  ["foo\bar\BAZ"]=>
  int(42)
}

But I expected this output instead:

array(1) {
  ["Foo\Bar\BAZ"]=>
  int(42)
}

This also affects user-defined constants, see #11423 (comment).

This behaviour was introduced in php 8.3 by the removal of the name field of the zend_constant struct in f42992f (#10954).

PHP Version

PHP 8.3-dev

Operating System

irrelevant

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions