Req #17207 [Opn->Fbk]: call_user_func_array does not bind array keys to params

From: Date: Mon, 28 Apr 2014 14:16:28 +0000
Subject: Req #17207 [Opn->Fbk]: call_user_func_array does not bind array keys to params
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185475@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=17207&edit=1

 ID:                 17207
 Updated by:         levim@php.net
 Reported by:        rcarmo at accao dot net
 Summary:            call_user_func_array does not bind array keys to
                     params
-Status:             Open
+Status:             Feedback
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            Arrays related
-Operating System:   Any
+Operating System:   Irrelevant
 PHP Version:        4.1.2
 Block user comment: N
 Private report:     N

 New Comment:

Is this something you are still interested in seeing?


Previous Comments:
------------------------------------------------------------------------
[2014-04-16 16:38:02] levim@php.net

This is similar to the RFC for named parameters: https://wiki.php.net/rfc/named_params

------------------------------------------------------------------------
[2002-05-14 09:29:02] rcarmo at accao dot net

Thanks. This would be extremely useful for XML-RPC/SOAP stuff with optional parameters (that have to
be validated down at the actual function call level). 

Since there is no way to actually get a valid argument list on the function BEFORE doing
call_user_func_array, I'm getting around it with stuff like this hideous kludge INSIDE the
actual function:

if( func_num_args() < 7 )
    return new CFault( "400", "Client", "Incorrect number of method
arguments", $php_errormsg );

------------------------------------------------------------------------
[2002-05-14 08:53:55] derick@php.net

This is not supposed to work at all, I'm making this a feature request.

Derick

------------------------------------------------------------------------
[2002-05-14 08:50:30] rcarmo at accao dot net

When calling a function with call_user_func_array, if one of the parameters is not set, the trailing
hash values are assigned to the wrong parameters.

function test( $a, $b, $c ) {
  echo "|$a:$b:$c|";
}

$aParams = array( "a" => 1, "c" => 3 );

call_user_func_array( "test", $aParams );

The output I get is
|1:3:|

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



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


Thread (6 messages)

« previous php.bugs (#185475) next »