php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52410 Namespaces affects existing code after upgrade
Submitted: 2010-07-22 23:49 UTC Modified: 2010-07-25 18:43 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: bugs dot php dot net at rootwerk dot de Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.2.14 OS: Ubuntu 10.04
Private report: No CVE-ID: None
 [2010-07-22 23:49 UTC] bugs dot php dot net at rootwerk dot de
Description:
------------
After upgradeing from php 5.2.4 to 5.3.2 (with ubuntu 10.4), the following code won't work:

<?PHP

 class namespace extends something {

 }

?>

The error message: PHP Parse error:  syntax error, unexpected T_NAMESPACE, expecting T_STRING in ...

The documentation says: 
Q: If I don't use namespaces, should I care about any of this?
A: No. Namespaces do not affect any existing code in any way
( http://www.php.net/manual/en/language.namespaces.faq.php )



Test script:
---------------
<?PHP

 class namespace extends something {

 }

?>

Expected result:
----------------
in this case, I won't define a php-namespace, but a functionality within my application, which was called so before namespaces existed in php.

Actual result:
--------------
PHP Parse error:  syntax error, unexpected T_NAMESPACE, expecting T_STRING in ...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-23 00:21 UTC] felipe@php.net
-Package: Class/Object related +Package: Documentation problem
 [2010-07-23 00:21 UTC] felipe@php.net
In the end of http://docs.php.net/manual/en/migration53.incompatible.php page are mentioned the new keywords introduced in 5.3.
But yes, the FAQ. needs an update to state this point.

Thanks.
 [2010-07-25 18:43 UTC] johannes@php.net
-Status: Open +Status: Bogus
 [2010-07-25 18:43 UTC] johannes@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

quoting the migration guide:

"The following keywords are now reserved and may not be used in function, class, etc. names.

    * goto
    * namespace"

http://php.net/manual/en/migration53.incompatible.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 10:01:30 2024 UTC