php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #52275 Add error reporting level for namespace fallback
Submitted: 2010-07-07 17:20 UTC Modified: 2010-07-08 12:57 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: crash at lubyte dot de Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 5.3.2 OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: crash at lubyte dot de
New email:
PHP Version: OS:

 

 [2010-07-07 17:20 UTC] crash at lubyte dot de
Description:
------------
Hello,

currently it's not possible to see if PHP tries to fallback to a global function/constant when the function/constant isn't found in the current namespace.

This can lead to perfomence problems when developers convert older classes to PHP 5.3 namespaces and forget to prefix standard functions with a backslash.

This also helps people to learn what functions need to be called from the global space and which not.

Test script:
---------------
namespace Foo;

function bar() {
    // would be nice if that would trigger a warning
    return phpversion();
}

function baz() {
    // no warning
    return \phpversion();
}

Expected result:
----------------
a error level constant E_NAMESPACE_FALLBACK to use for error_reporting()


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-08 12:57 UTC] johannes@php.net
-Status: Open +Status: Wont fix
 [2010-07-08 12:57 UTC] johannes@php.net
Triggering an error - even when not shown - is way slower than the additional lookup which is well optimised.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 17:01:30 2024 UTC