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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
7 + 23 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 04:01:30 2024 UTC