[PHP-DEV] call_user_*() From: Sterling Hughes (sterling <email protected>)
Date: 05/12/01

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

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>