[PHP-BUG] Bug #54893 [NEW]: Namspace import doesn't work
From: Operating system: Windows 7 PHP version: 5.3SVN-2011-05-20 (SVN) Package: *Compile Issues Bug Type: Bug Bug description:Namspace import doesn't work Description: I'm running XAMPP on Win7 with PHP 5.3.5 (don't know whether I got that one above selected right...) I tried importing a namespace and instantiating a class in there in another namespace, but it seemed not to have worked. --- From manual page: http://www.php.net/language.namespaces.importing --- Test script: --- ?php namespace NamespaceOne { class OutOfBoundsException extends \OutOfBoundsException { } } namespace NamespaceTwo { use NamespaceOne; throw new OutOfBoundsException; } ? Expected result: Fatal error: Uncaught exception 'NamespaceOne\OutOfBoundsException' Actual result: -- Fatal error: Class 'NamespaceTwo\OutOfBoundsException' not found in ... -- Edit bug report at http://bugs.php.net/bug.php?id=54893edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54893r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54893r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54893r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54893r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54893r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54893r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54893r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54893r=needscript Try newer version: http://bugs.php.net/fix.php?id=54893r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54893r=support Expected behavior: http://bugs.php.net/fix.php?id=54893r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54893r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54893r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54893r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54893r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=54893r=dst IIS Stability: http://bugs.php.net/fix.php?id=54893r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54893r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54893r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54893r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54893r=mysqlcfg
Bug #54893 [Opn]: Namspace import doesn't work
Edit report at http://bugs.php.net/bug.php?id=54893edit=1 ID: 54893 User updated by:marcel dot klehr at gmx dot de Reported by:marcel dot klehr at gmx dot de Summary:Namspace import doesn't work Status: Open Type: Bug Package:*Compile Issues Operating System: Windows 7 -PHP Version:5.3SVN-2011-05-20 (SVN) +PHP Version:5.3.5 Block user comment: N Private report: N New Comment: just altered the PHP version... Previous Comments: [2011-05-20 15:19:55] marcel dot klehr at gmx dot de Description: I'm running XAMPP on Win7 with PHP 5.3.5 (don't know whether I got that one above selected right...) I tried importing a namespace and instantiating a class in there in another namespace, but it seemed not to have worked. --- From manual page: http://www.php.net/language.namespaces.importing --- Test script: --- ?php namespace NamespaceOne { class OutOfBoundsException extends \OutOfBoundsException { } } namespace NamespaceTwo { use NamespaceOne; throw new OutOfBoundsException; } ? Expected result: Fatal error: Uncaught exception 'NamespaceOne\OutOfBoundsException' Actual result: -- Fatal error: Class 'NamespaceTwo\OutOfBoundsException' not found in ... -- Edit this bug report at http://bugs.php.net/bug.php?id=54893edit=1
Bug #54893 [Bgs]: Namspace import doesn't work
Edit report at http://bugs.php.net/bug.php?id=54893edit=1 ID: 54893 User updated by:marcel dot klehr at gmx dot de Reported by:marcel dot klehr at gmx dot de Summary:Namspace import doesn't work Status: Bogus Type: Bug Package:*Compile Issues Operating System: Windows 7 PHP Version:5.3.5 Block user comment: N Private report: N New Comment: I was under the impression that all items of that imported namespace are available unqualified in the new one. But now i see, you still have to qualify it with its imported name... Shoulf have been pointed out more clearly in the docs! Anyway, why don't you implement this. Importing all items of a particular namespace?! Previous Comments: [2011-05-20 15:56:50] johan...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Please re-read the import section. You might need something like use NamespaceOne\OutOfBoundsException; [2011-05-20 15:29:37] marcel dot klehr at gmx dot de just altered the PHP version... [2011-05-20 15:19:55] marcel dot klehr at gmx dot de Description: I'm running XAMPP on Win7 with PHP 5.3.5 (don't know whether I got that one above selected right...) I tried importing a namespace and instantiating a class in there in another namespace, but it seemed not to have worked. --- From manual page: http://www.php.net/language.namespaces.importing --- Test script: --- ?php namespace NamespaceOne { class OutOfBoundsException extends \OutOfBoundsException { } } namespace NamespaceTwo { use NamespaceOne; throw new OutOfBoundsException; } ? Expected result: Fatal error: Uncaught exception 'NamespaceOne\OutOfBoundsException' Actual result: -- Fatal error: Class 'NamespaceTwo\OutOfBoundsException' not found in ... -- Edit this bug report at http://bugs.php.net/bug.php?id=54893edit=1