|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-01-18 11:38 UTC] dmitry@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 20:00:01 2025 UTC |
Description: ------------ call_user_func_array() uses a compounded if() statement on line 1996 in file ext/standard/basic_functions.c of the current CVS snapshot (200412192330) and v5.0.3 Stable which catches the Exceptions improperly. call_user_func() does not have this compounded if() statement, and works properly. To fix the code, change the following if statement: if (call_user_function_ex(EG(function_table), NULL, *func, &retval_ptr, count, func_params, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) { To: if (call_user_function_ex(EG(function_table), params[1], *params[0], &retval_ptr, arg_count-2, params+2, 0, NULL TSRMLS_CC) == SUCCESS) { if (retval_ptr) { NOTE: This is a duplicate of #28934, which has had this same bug fix in it since early September prior to v5.0.2. I'm opening a new report in hopes that it will bring attention to this known bugfix this will fixed in the CVS and adopted prior the next version of PHP 5.0.x. Reproduce code: --------------- <?php class test { function throwException() { throw new Exception("Hello World!\n"); } } $array = array(new test(), 'throwException'); try { call_user_func($array, 1, 2); } catch (Exception $e) { echo $e->getMessage(); } try { call_user_func_array($array, array(1, 2)); } catch (Exception $e) { echo $e->getMessage(); } Expected result: ---------------- $ php -f call_user_func.php Hello World! Hello World! Actual result: -------------- $ php -f call_user_func.php Hello World! <br /> <b>Warning</b>: call_user_func_array() [<a href='function.call-user-func-array'>function.call-user-func-array</a>]: Unable to call test::throwException() in <b>/home/tswicegood/Desktop/BrainDump/phpbin/call_user_func.php</b> on line <b>19</b><br /> Hello World!