[PHP-BUG] Bug #69557 [NEW]: Unexpected error message using "use" operator before the "namespace" keyword
[email protected] ("me at paulofreitas dot me")
| Newsgroups | php.standards |
|---|---|
| Message-ID | <[email protected]> |
From: me at paulofreitas dot me Operating system: N/A PHP version: 5.6.8 Package: PHP Language Specification Bug Type: Bug Bug description:Unexpected error message using "use" operator before the "namespace" keyword Description: ------------ As stated, if you try to use the "use" operator to import something before declaring the file namespace, you'll get an unexpected error message which doesn't actually explain the real issue. Test script: --------------- To reproduce the bug: http://3v4l.org/Qc9UO Expected result: http://3v4l.org/XOGsn (you get the idea...) Expected result: ---------------- Fatal error: Namespace declaration statement has to be the very first statement in the script in test.php on line 5 Actual result: -------------- Fatal error: Class 'Foo\Bar' not found in test.php on line 7 -- Edit bug report at https://bugs.php.net/bug.php?id=69557&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69557&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69557&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69557&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69557&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69557&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69557&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69557&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69557&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69557&r=support Expected behavior: https://bugs.php.net/fix.php?id=69557&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69557&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69557&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69557&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69557&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69557&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69557&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69557&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69557&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69557&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69557&r=mysqlcfg