From: codronm+circlecode at gmail dot com
Operating system: linux
PHP version: 5.5.3
Package: Scripting Engine problem
Bug Type: Bug
Bug description:defined and constant does not resolve use aliases
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 bug report at https://bugs.php.net/bug.php?id=65560&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=65560&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=65560&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=65560&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=65560&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=65560&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65560&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=65560&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=65560&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=65560&r=support
Expected behavior: https://bugs.php.net/fix.php?id=65560&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=65560&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=65560&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=65560&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65560&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=65560&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=65560&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=65560&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65560&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65560&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=65560&r=mysqlcfg