call_user_*()
| From: | Sterling Hughes | Date: | Sat, 12 May 2001 19:28:55 +0000 |
| Subject: | call_user_*() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-55033@lists.php.net to get a copy of this message | ||
Howdy all,
I've been going through the call_user_*() functions in basic_functions.c and just a couple of notes/things I found odd.1) With a aforementioned bug, thies was right, the following code fails, but it shouldn't: <?php function get_reference_as_arg(&$param) {
var_dump($param);} $name = "get_reference_as_arg"; $param1 = array(1, 2); call_user_func($name, $param1); ?> Fails. Whereas, replacing the call_user_func above with the following: call_user_func($name, array($param1)); Works fine (2-D array gets passed). 2) I've already fixed this in my local version, however, if the call_user_*() functions fail, the error: "Couldn't find function" is displayed. This is incorrect. call_user_function_ex() can fail for other reasons, making the message incorrect. 3) call_user_func() and call_user_method() both accept the array($obj, "method") syntax. Its seems to me that the call_user_method*() are therefore repetitive. Therefore, I'd suggest that call_user_function() & call_user_function_ex() (Zend API) need to be more descriptive with their return values. The problem is not only apparent in this situation, but also in other places I have often wished for better error reporting. Also, since the call_user_method*() functions are repetitive, we should probably nuke them at one point (and for now, have an E_NOTICE message saying that "these functions are outdated, use the array($obj, "method") syntax"). Thoughts? -Sterling