ID:               28934
 Comment by:       phpbugs at d51 dot biz
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Zend Engine 2 problem
 Operating System: Linux
 PHP Version:      5.0.0RC3
 New Comment:

I ran the following to see if the exception was being thrown.  It is
thrown and caught:

Reproduce code:
---------------
<?php
function foo()
{
        throw new Exception('bar');
}

try {
                call_user_func_array('foo', array());
                
} catch (Exception $e) {
        echo $e->getMessage();
}

// Expected output: bar
?>

Actual result:
--------------
Warning: call_user_func_array() [function.call-user-func-array]: Unable
to call foo() in /path/to/test.php on line 16
bar


Extended Info:
--------------
I also attempted catching an exception with call_user_func() - it
worked as expected producing only "bar".  I also produced an identical
outcome when I used a non-empty array as the second argument.

This is most definitely an issue with call_user_func_array().  The
following code produces a similar error:


Reproduce code:
---------------
<?php
assert_options( ASSERT_CALLBACK, 'throwException' );
function foo()
{
        assert( false );
        throw new Exception('bar');
}

function throwException( ) {
        throw new Exception('assert');
}

try {
        call_user_func_array('foo', array(0, 1));
} catch (Exception $e) {
        echo $e->getMessage();
}

// Expected Output: assert
?>

Actual results:
---------------
Warning: assert() [function.assert]: Assertion failed in
/path/to/test.php on line 7

Warning: call_user_func_array() [function.call-user-func-array]: Unable
to call foo() in /path/to/test.php on line 20
assert


More Info:
----------
Bug #29617 seems to be a duplicate of this report.


Previous Comments:
------------------------------------------------------------------------

[2004-08-01 23:17:58] JustinHagstrom at yahoo dot com

This also happens when an exception is thrown in any callback
function.
It is present in the final release of PHP 5 and the snapshots from Aug
01, 2004.

------------------------------------------------------------------------

[2004-06-27 23:21:47] [EMAIL PROTECTED]

Description:
------------
When a function called by call_user_func_array() throws an exception,
an error appears: "Warning: call_user_func_array()
[function.call-user-func-array]: Unable to call babba() in
/data/webdev/classes/Tree/demo.php on line 19"

Reproduce code:
---------------
<?php
function babba()
{
    throw new Exception('foo');
}

try {
    call_user_func_array('babba', array());
    
} catch (Exception $e) {
    // Eek
}
?>

Expected result:
----------------
Nothing

Actual result:
--------------
Warning: call_user_func_array() [function.call-user-func-array]: Unable
to call babba() in /data/webdev/classes/Tree/demo.php on line 43


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=28934&edit=1

Reply via email to