Bug #72159 [NEW]: Imported Class Overrides Local Class Name

From: Date: Wed, 04 May 2016 15:24:41 +0000
Subject: Bug #72159 [NEW]: Imported Class Overrides Local Class Name
Groups: php.standards 
Request: Send a blank email to standards-+get-1088@lists.php.net to get a copy of this message
From: rod at owsy dot com Operating system: All PHP version: 7.0.6 Package: PHP Language Specification Bug Type: Bug Bug description:Imported Class Overrides Local Class Name Description: ------------ When importing a class into a namespace it seems to override any classes with that name in the current namespace (PHP 7.0+) https://3v4l.org/tGv74 Test script: --------------- <?php namespace Foo { class Bar { public $from = 'foo'; } } namespace Bazzle { use Foo\Bar; class Bar { public $from = 'bazzle'; } echo (new Bar())->from; } Expected result: ---------------- Fatal error: Cannot declare class Bazzle\Bar because the name is already in use Actual result: -------------- 'foo' is echo'd -- Edit bug report at https://bugs.php.net/bug.php?id=72159&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72159&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72159&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72159&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=72159&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=72159&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=72159&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=72159&r=needscript Try newer version: https://bugs.php.net/fix.php?id=72159&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=72159&r=support Expected behavior: https://bugs.php.net/fix.php?id=72159&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=72159&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=72159&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=72159&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72159&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=72159&r=dst IIS Stability: https://bugs.php.net/fix.php?id=72159&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=72159&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=72159&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=72159&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=72159&r=mysqlcfg

« previous php.standards (#1088) next »