php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77412 PHP5 namespace PHP Fatal error, can not use ? as ? because the name is already
Submitted: 2019-01-05 02:19 UTC Modified: 2019-01-05 09:25 UTC
From: im dot lyb at qq dot com Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 5.6.39 OS: osx/ubuntu14.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: im dot lyb at qq dot com
New email:
PHP Version: OS:

 

 [2019-01-05 02:19 UTC] im dot lyb at qq dot com
Description:
------------
PHP Fatal error:  Cannot use app\model\ServiceA as ServiceA because the name is already in use in /app/service/ServiceB.php on line 11


Under php5

In a directory, when use a class, if the directory has a same class name(not include namespace pre) and has been included before, will trigger a error.

PHP7 is ok!

code sample: https://github.com/liuyibao/php5-namespace-bug-report

Test script:
---------------
Under php5

In a directory, when use a class, if the directory has a same class name(not include namespace pre) and has been included before, will trigger a error.

PHP7 is ok!

code sample: https://github.com/liuyibao/php5-namespace-bug-report


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-01-05 09:25 UTC] nikic@php.net
-Status: Open +Status: Wont fix -Package: PHP Language Specification +Package: Scripting Engine problem
 [2019-01-05 09:25 UTC] nikic@php.net
Name conflict rules have been relaxed at some point during PHP 7 to allow such usages. This will not be changed on PHP 5 though, because PHP 5 is no longer supported.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 21:01:35 2025 UTC