Bug #65560 [Opn]: defined and constant does not resolve use aliases

From: Date: Mon, 26 Aug 2013 14:09:11 +0000
Subject: Bug #65560 [Opn]: defined and constant does not resolve use aliases
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-181205@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65560&edit=1 ID: 65560 User updated by: codronm+circlecode at gmail dot com Reported by: codronm+circlecode at gmail dot com Summary: defined and constant does not resolve use aliases Status: Open Type: Bug Package: Scripting Engine problem Operating System: linux PHP Version: 5.5.3 Block user comment: N Private report: N New Comment: Sorry, I have inverted Expected result and actual result… I don't know how to edit this Previous Comments: ------------------------------------------------------------------------ [2013-08-26 13:56:49] codronm+circlecode at gmail dot com 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65560&edit=1

« previous php.bugs (#181205) next »