Bug #49143 [Opn->Csd]: is_callable() and unnecessary backslash

From: Date: Thu, 10 Jun 2010 22:52:55 +0000
Subject: Bug #49143 [Opn->Csd]: is_callable() and unnecessary backslash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-151308@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=49143&edit=1

 ID:               49143
 Updated by:       felipe@php.net
 Reported by:      david at grudl dot com
 Summary:          is_callable() and unnecessary backslash
-Status:           Open
+Status:           Closed
 Type:             Bug
 Package:          Class/Object related
 Operating System: *
 PHP Version:      5.3.0
-Assigned To:      
+Assigned To:      felipe

 New Comment:

This already was fixed for the next release.
See bug #50731

Thanks.


Previous Comments:
------------------------------------------------------------------------
[2010-06-11 00:48:15] alex dot howansky at gmail dot com

This bug is still present in 5.3.2 and also affects instantiating a new
class 
from a string variable:

function __autoload($class)
{
    echo "$class\n";
}

$obj = new MyProject\Thing();
// correct: MyProject\Thing

$obj = new \MyProject\Thing();
// correct: MyProject\Thing

$class = '\\MyProject\\Thing';
$obj = new $class();
// wrong: \MyProject\Thing

------------------------------------------------------------------------
[2010-04-09 08:18:22] abca_b_cabcom at hotmail dot com

hi david, you are not in a namespace it is just a classname.

------------------------------------------------------------------------
[2009-08-04 11:24:35] david at grudl dot com

The two same class invokes autoloader with different class name (maybe 
better term is non-canonicalized class name).

This means: every autoloader must call $name = ltrim($name, "\").

defined() removes leading "\" automatically, is_callable and 
method_exists do not.

------------------------------------------------------------------------
[2009-08-04 11:16:07] jani@php.net

Yes, which problem..? I don't see any errors. 

------------------------------------------------------------------------
[2009-08-04 00:34:46] david at grudl dot com

Tested with 5.3.1-dev (Sun, 02 Aug 2009 18:53:57 +0000), problem still 
exists.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=49143


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=49143&edit=1


Thread (8 messages)

« previous php.bugs (#151308) next »