From:             
Operating system: Linux
PHP version:      5.3.5
Package:          Reproducible crash
Bug Type:         Bug
Bug description:is_callable invoke autoloading unnecessarilly

Description:
------------
The PHP core function "is_callable" invokes the autoloading when receives a
string callback that has "::", even when the class has not a valid name.



It could be smarter invoking autoloading only when the class name is a
valid class name, as described by the expression
[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* from documentation
(http://www.php.net/manual/en/language.oop5.basic.php). It should check
whether a namespace was used too.



Often, is_callable function is not invoked in a try/catch context. So, in
many cases, it could crash PHP execution. For example, in a dispatcher
implementation that receives a controller class and an action (method) by
user, create a callback and test it with is_callable.

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



function __autoload($class) { 

    printf("Required class: '%s'\n", $class);

    throw new Exception('Error');

}



var_dump(is_callable('invalid name::method'));

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

Actual result:
--------------
Required class: 'invalid name'

PHP Fatal error:  Uncaught exception 'Exception' with message 'Error' in
%s:5

-- 
Edit bug report at http://bugs.php.net/bug.php?id=53932&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=53932&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=53932&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=53932&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=53932&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53932&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=53932&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=53932&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=53932&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=53932&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=53932&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=53932&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=53932&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=53932&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=53932&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53932&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53932&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=53932&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=53932&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=53932&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=53932&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=53932&r=mysqlcfg

Reply via email to