|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-08-26 14:09 UTC] codronm+circlecode at gmail dot com
[2013-08-26 14:09 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
[2013-08-26 14:09 UTC] nikic@php.net
[2013-08-26 14:16 UTC] codronm+circlecode at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 26 07:00:01 2025 UTC |
Description: ------------ while var_dump resolves correctly aliases defines by the use keyword, defined and constant functions does not resolve it. Test script: --------------- <?php namespace Foo; class Bar { const baz = 'baz'; } function test($const){ if(defined($const)){ echo "$const value is ". constant($const) . "\n"; } else { echo "$const is not defined" . "\n"; } } use \Foo\Bar as Bar; var_dump(\Foo\Bar::baz); test("\Foo\Bar::baz"); var_dump(Bar::baz); test("Bar::baz"); Expected result: ---------------- string(3) "baz" \Foo\Bar::baz value is baz string(3) "baz" Bar::baz is not defined Actual result: -------------- string(3) "baz" \Foo\Bar::baz value is baz string(3) "baz" Bar::baz value is baz