php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46823 backward compatibility of namespaces
Submitted: 2008-12-10 14:47 UTC Modified: 2008-12-17 04:40 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: Thomas dot Worm at gsp-software dot de Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.3.0alpha3 OS: *
Private report: No CVE-ID: None
 [2008-12-10 14:47 UTC] Thomas dot Worm at gsp-software dot de
Description:
------------
I would like to do backward compatibility in namespace code.

Reproduce code:
---------------
<?php

if ( (float) substr(phpversion(),0,3) >= 5.3)
namespace MySpace\SubSpace;

?>
<?

if ( (float) substr(phpversion(),0,3) >= 5.3)
use MySpace\SubSpace\MyClass;

?>

Expected result:
----------------
In PHP >= 5.3... All classes are in \MySpace\SubSpace
In PHP < 5.3... All classes are in global Space \


Actual result:
--------------
Parse error: parse error, expecting `T_NS_SEPARATOR' in space.lib.php on line 3

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-17 04:40 UTC] kalle@php.net
We cannot change past releases, as adding BC for new language elements/constructs in future versions requires the parser to be altered.

Same thing with PHP4 doesn't support method chainging, or PHP 5.1 allows Array as type hint. If you want to use namespaces you will need to use PHP 5.3 or greater, BC cannot and will not be added.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 10 11:01:32 2024 UTC