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
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: 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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu May 08 09:01:27 2025 UTC