Home » PHP » PHP_Shell » Bug #8554
Raises Exception for Dynamically Dispatched Functions
Details
| Submitted | 2006-08-24 20:57 UTC |
|---|---|
| From | ripta dot pasay at lunarpages dot com |
| Assigned | jespino |
| Status | Closed |
| Package | PHP_Shell |
| PHP Version | 5.1.4 |
| OS | CentOS release 3.5 (Final) |
| Roadmaps | (Not assigned) |
Comments
[2006-08-24 20:57 UTC] ripta dot pasay at lunarpages dot com
Description:
------------
When function calls are handled by __call (PHP 5.x only), PHPShell will raise an Exception on line 346, because it uses method_exists() to check whether the function exists or not.
Using is_callable() instead of method_exists() will handle __call()s correctly. A down side: is_callable() seems to always return TRUE if __call() exists.
Test script:
---------------
class Test
{
public function __call($methodName, $argList)
{
echo "$methodName called\n";
}
}
$t = new Test();
$t->doIt();
Expected result:
----------------
doIt called
Actual result:
--------------
Exception (code: 0) got thrown
exception 'Exception' with message 'Variable $t (Class 'Test') doesn't have a method named 'doIt'' in /usr/local/lib/php/PHP/Shell.php:346
Stack trace:
#0 /usr/local/lib/php/php-shell-cmd.php(116): PHP_Shell->parse()
#1 {main}