Bug #69557 [Opn->Nab]: Unexpected error message using "use" operator before the "namespace" keyword

[email protected]
Newsgroups php.standards
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=69557&edit=1

 ID:                 69557
 Updated by:         [email protected]
 Reported by:        me at paulofreitas dot me
 Summary:            Unexpected error message using "use" operator before
                     the "namespace" keyword
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            PHP Language Specification
 Operating System:   N/A
 PHP Version:        5.6.8
 Block user comment: N
 Private report:     N

 New Comment:

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




Previous Comments:
------------------------------------------------------------------------
[2015-05-01 04:49:39] me at paulofreitas dot me

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 this bug report at https://bugs.php.net/bug.php?id=69557&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.