Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I wanted to start a separate thread for this issue because I think it was reported on another thread that sorta had something to do with it but anyhow..
With PHP 5.3 and above something changed in call_user_fun_array thats throwing off the services module in instances such as system.connect, system.getServices etc.
warning: call_user_func_array() expects parameter 2 to be array, null given in /var/www/sites/all/modules/services/services.module on line 434
and I think same error on 450...
Server, Ubuntu.. running Apache 2 with PHP Version 5.3.2-1ubuntu4.2
Comment | File | Size | Author |
---|---|---|---|
#6 | services-809226.patch | 652 bytes | gilgabar |
Comments
Comment #1
gateway69 CreditAttribution: gateway69 commentedany updates to this, im in the process of writing service modules and seeing this quite often now with a very basic test.. its also returning access denied...
Comment #2
codekarate CreditAttribution: codekarate commentedI am also in the process of writing services modules and am seeing this same error.
Server OS: Ubuntu
Webserver: Nginx
PHP: 5.3
Comment #3
codekarate CreditAttribution: codekarate commentedI took a look at the code and was able to get around this error by making sure I passed some type of argument ('#args') in hook_service. It looks like the code expects you to have some type of argument declared, even if it is an optional argument.
I don't think it is the end solution but it is a good work around for me.
Comment #4
estenat CreditAttribution: estenat commentedI verified the trouble is in call_user_func_array (function services_method_call inside services.module) when it assigns values to $access_arguments at row 423:
$access_arguments = $method['access arguments'];
because this assignement makes $access_arguments a simple string variable, instead of an array variable.
The following row:
$access_arguments = array($method['access arguments']);
load an effective array...
This solved my problem that raised installing services 6.x-2.1 over 6.x-2.0 (as I reported in issue 'Service does not work with Dash Media Player')
Comment #5
gilgabar CreditAttribution: gilgabar commentedThe problem doesn't appear to be in services_method_call() but in one of the functions that calls it. The second argument, $args, should be an array, but it is actually a NULL. That NULL is being passed from the function calling it. In this case it looks like only the admin testing interface is affected. I wasn't able to create any errors querying the xmlrpc server directly.
So the problem lies in services_admin_browse.inc. The calling function is services_admin_browse_test_submit(). The $args variable is populated by services_admin_browse_test_unserialize_args(), which is creating the NULL value. It looks like a simple uninitialized return variable. If there are no $values passed to the function then it will return the $return variable without actually assigning any value to it. The solution that works for me is to just initialize that $return variable as an empty array.
Comment #6
gilgabar CreditAttribution: gilgabar commentedHere is a patch.
Comment #7
gdoteof CreditAttribution: gdoteof commented#6: services-809226.patch queued for re-testing.
Comment #8
jonathan_hunt CreditAttribution: jonathan_hunt commentedI found a similar issue in services_method_call() in services.module ~ line 445. For a method defined with no args, $args is NULL and call_user_func_array() dies. The following is a workaround:
Comment #9
gilgabar CreditAttribution: gilgabar commentedThat should also be resolved by the patch in #6. It's the same variable.
Comment #10
marcingy CreditAttribution: marcingy commentedAh this appears as duplicate of the commit I made earlier, marking as fixed given that, this fix is in 6-x-2 head.
Comment #12
EDDYL CreditAttribution: EDDYL commentedThis bug IS NOT fixed :
call_user_func_array() expects parameter 2 to be array, string given in C:\Program Files\EasyPHP-5.3.6.0\www\drupal_preprod\modules\services\services.module on line 446.
Unable to deploy content-types
Comment #13
marcingy CreditAttribution: marcingy commented6.2 is no longer supported so this issue will not be fixed anyway. And the usage of capitals is a sure way to ensure that is the case.
Comment #14
babymission CreditAttribution: babymission commentedI could not find this string in my Service module (Services 6.x-0.15). Instead I can only find the following:-
$access_arguments = isset($method['#access arguments']) ? $method['#access arguments'] : $args;
// Call default or custom access callback
if (call_user_func_array($method['#access callback'], $access_arguments) != TRUE) {
return services_error(t('Access denied.'));
How should I modify this to make it work? Thanks.
Comment #15
qasimzee CreditAttribution: qasimzee commentedI changed line 435 to
$access_arguments[] = $method['access arguments'];
and the error is fixedComment #16
freebug CreditAttribution: freebug commentedI was able to solve my issue be putting the following code at the top of the "services_method_call" function, in the services.module file:
Also I made changes to the includes/xmlrpcs.inc (line no 150 in my case). Added check for 'null' also:
This might not be necessary in all the cases.