Bug #54910 [Asn->Csd]: Crash when calling call_user_func with unknown function name
| From: | dmitry@php.net | Date: | Tue, 31 May 2011 09:21:36 +0000 |
| Subject: | Bug #54910 [Asn->Csd]: Crash when calling call_user_func with unknown function name | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161068@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54910&edit=1
ID: 54910
Updated by: dmitry@php.net
Reported by: aigors at inbox dot lv
Summary: Crash when calling call_user_func with unknown
function name
-Status: Assigned
+Status: Closed
Type: Bug
Package: Reproducible crash
Operating System: Ubuntu 11.04
PHP Version: 5.3.6
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2011-05-31 11:20:53] dmitry@php.net
Automatic comment from SVN on behalf of dmitry
Revision: http://svn.php.net/viewvc/?view=revision&revision=311635
Log: Fixed bug #54910 (Crash when calling call_user_func with unknown
function name)
------------------------------------------------------------------------
[2011-05-23 16:18:09] aigors at inbox dot lv
Description:
------------
Firstly the function is_callable(array('B', 'noSuchMethod')) returns
true even
such static method does not exist. This could be caused by class A
having magic
method __call (which shouldn't accept static methods though).
Still because of this the code fails with segmentation fault.
Test script:
---------------
class A
{
public function __call($method, $args)
{
if (stripos($method, 'get') === 0) {
return $this->get();
}
throw new BadMethodCallException("No such method");
}
protected function get()
{
$class = get_class($this);
$call = array($class, 'noSuchMethod');
if (is_callable($call)) {
call_user_func($call);
}
}
}
class B extends A {}
$input = new B();
echo $input->getEmail();
Expected result:
----------------
Script should end with no output.
Actual result:
--------------
Segmentation fault.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54910&edit=1