php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53920 is_callable is invoking autoloading incorrectly
Submitted: 2011-02-03 19:56 UTC Modified: 2011-02-04 12:40 UTC
Votes:4
Avg. Score:2.0 ± 0.7
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:1 (25.0%)
From: rubs33 at gmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.5 OS: Linux
Private report: No CVE-ID: None
 [2011-02-03 19:56 UTC] rubs33 at gmail dot com
Description:
------------
When you set a string variable with a value like "return any_class::any_method();" and use it on "is_callable" PHP core function, the autoloading is invoked trying to load a class named "return any_class".

Test script:
---------------
<?php

function __autoload($class) {
    printf("Required class: '%s'\n", $class);
}

$code =	'return foo::bar();';

var_dump(is_callable($code));

Expected result:
----------------
bool(false)

Actual result:
--------------
Required class: 'return foo'
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-02-04 10:27 UTC] aharvey@php.net
-Status: Open +Status: Wont fix
 [2011-02-04 10:27 UTC] aharvey@php.net
I don't think there's any real value in trying to make is_callable()
smarter in this case. Garbage in, garbage out.
 [2011-02-04 12:40 UTC] rubs33 at gmail dot com
-Status: Wont fix +Status: Closed
 [2011-02-04 12:40 UTC] rubs33 at gmail dot com
Ok.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 04:01:31 2024 UTC