|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-10-16 15:22 UTC] arnout at argeweb dot nl
Description:
------------
When using is_callable on non-existing static class functions __autoload will be called twice with some encoded (and thus non-existent) classname.
Reproduce code:
---------------
autoload.php
<?php
class test{
function notest(){
}
}
function __autoload( $classname ){
echo "let's require $classname!<br/>\n";
}
if( is_callable( array( 'test', 'test' ) ) ){
echo "test::test exists.";
}else{
echo "test::test doesn't exist.";
}
?>
Expected result:
----------------
test::test doesn't exist.
(no __autoload execution at all)
Actual result:
--------------
let's require 9akf!
let's require 9akf!
test::test doesn't exist.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 05:00:01 2025 UTC |
I've seen the same thing on PHP 5.2.9 FreeBSD 7.1-RELEASE-p3: <? function __autoload($class){ print "trying to load $class\n"; } class foo {} is_callable(array("foo", "bar")); ?> And I get trying to load ffe trying to load ffe Instead of no output.I have a similar problem here: Debian Linux PHP package "PHP 5.3.3-7+squeeze14 with Suhosin-Patch (cli) (built: Aug 6 2012 14:18:06)": Reproduce code: --------------- <?php spl_autoload_register('testAutoloader'); is_callable(array('A', 'mymethod')); is_callable(array('Foo', 'mymethod')); is_callable(array('ALongerClassName', 'mymethod')); function testAutoloader($sClassName) { print $sClassName . "\n"; } Expected result: ---------------- A Foo ALongerClassName Actual result: -------------- A w A w A Foo ffe Foo ffe Foo ALongerClassName q9998tg6zai2xxrw ALongerClassName q9998tg6zai2xxrw ALongerClassName