From:             rodolfo at rodsoft dot org
Operating system: linux 2.6.6
PHP version:      5.0.0RC2
PHP Bug Type:     Reproducible crash
Bug description:  crash in recursive call of __call

Description:
------------
This ill-behaved code crashes php. I know one should never write things
like this, but this sample is an oversimplified version of a much bigger
code I'm working with, and I've just spot my error after trying to
simplify the code to attach here. PHP should emmit a warning when such
things happen, as with __set and __get, saying that $this->func() isn't
defined, when called inside a __call handler.

Reproduce code:
---------------
<?

class test
{
    function __call($func, $args)
    {
        $this->hello();
    }
}

$a = new test;
$a->hello();
echo "You won't read this";

?>


Expected result:
----------------
A warning saying that $this->hello isn't defined.

Actual result:
--------------
The coredump is a bunch of

#0 0x0821d843 in zend_call_function ()
#1 0x0821e76a in call_user_function_ex ()
#2 0x0823cfa5 in zend_std_call_user_call ()
#3 0x0825f8ee in zend_do_fcall_common_helper ()
#4 0x0825faf1 in zend_do_fcall_by_name_handler ()
#5 0x0824daf8 in execute ()

repeated over and over

-- 
Edit bug report at http://bugs.php.net/?id=28713&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28713&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28713&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28713&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28713&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28713&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28713&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28713&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28713&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28713&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28713&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28713&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28713&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28713&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28713&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28713&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28713&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28713&r=float

Reply via email to