From:             
Operating system: Ubuntu
PHP version:      5.3.6
Package:          *Programming Data Structures
Bug Type:         Bug
Bug description:Namespace importation order seems relevant

Description:
------------
1) Create the file named main.php (see test script section).
2) In the same directory of main.php, create a file named ns_class2.php
(see test script section).
3) In the same directory of main.php, create a file named
ns_ns1_ns2_class1.php (see test script section).
4) In the same directory of main.php, create a file named
ns_ns1_ns2_class2.php (see test script section).
5) Execute php -n main.php in CLI.
6) Invert require_once 'ns_ns1_ns2_class2.php' and require_once
'ns_ns1_ns2_class1.php' in main.php.
5) Execute php -n main.php in CLI.

Test script:
---------------
file main.php :
<?php

require_once 'ns_class2.php';
require_once 'ns_ns1_ns2_class2.php';
require_once 'ns_ns1_ns2_class1.php';

?>

file ns_class2.php :
<?php

namespace ns;

class class2 {}

?>

file ns_ns1_ns2_class1.php :
<?php

namespace ns\ns1\ns2;

use ns\class2;

class class1 {}

?>

file ns_ns1_ns2_class2.ph :
<?php

namespace ns\ns1\ns2;

class class2 {}

?>

Expected result:
----------------
Nothing in all cases.

Actual result:
--------------
When ns_ns1_ns2_class2.php was included before ns_ns1_ns2_class1.php :
Fatal error: Cannot use ns\class2 as class2 because the name is already in
use in /home/fhardy/tmp/ns_ns1_ns2_class1.php on line 5

When ns_ns1_ns2_class2.php was included after ns_ns1_ns2_class1.php :
Nothing

-- 
Edit bug report at https://bugs.php.net/bug.php?id=55068&edit=1
-- 
Try a snapshot (PHP 5.2):            
https://bugs.php.net/fix.php?id=55068&r=trysnapshot52
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=55068&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=55068&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=55068&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55068&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=55068&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=55068&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=55068&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=55068&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=55068&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=55068&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=55068&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=55068&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=55068&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=55068&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=55068&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=55068&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=55068&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=55068&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=55068&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=55068&r=mysqlcfg

Reply via email to