|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-02-17 10:19 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
[2019-02-17 10:19 UTC] nikic@php.net
[2019-02-17 10:21 UTC] requinix@php.net
-Status: Not a bug
+Status: Open
[2019-02-17 10:21 UTC] requinix@php.net
[2019-02-17 10:36 UTC] dams@php.net
[2019-02-17 10:53 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
[2019-02-17 10:53 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 10:00:02 2025 UTC |
Description: ------------ Using an import alias and defining the constant in the same scope leads to inconsistent error message : Undefined constant 'C' C is aliased into D first. Then it is created. Its creation is validated by 'echo C', which yields the right value. 'echo D' fails, mentioning that 'C' doesn't exists. Extra note : + splitting the namespace A in two (one with const, one with use) raise the same issue. + use and const may be in any order (use first, const first), still raise the same issue. Test script: --------------- <?php namespace A { use const C as D; const C = 2; echo C; echo D; } Expected result: ---------------- 22 Actual result: -------------- 2PHP Fatal error: Uncaught Error: Undefined constant 'C' in test.php:8 Stack trace: #0 {main} thrown in test.php on line 8