I'm trying to call a web service and send it two parameters, a string and an array. I haven't found what format elgg supports for sending arrays, but I've tried out a few common sense possibilities and none of them work. I've tried to debug the code a little, and it seems to me that there is a bug around here (\mod\web_services\lib\web_services.php, line 274):
case 'array':
// we can handle an array of strings, maybe ints, definitely not booleans or other arrays
if (!is_array($parameters[$key])) {
$msg = elgg_echo('APIException:ParameterNotArray', array($key));
throw new APIException($msg);
}
Basically, this piece of code is called if the input parameter for a web service is marked as array. $parameters[$key] gives parameter value. However, no matter what I try, $parameters[$key] is always a string (as it was sent through POST)., while is_array obviously expects to get an array there. So either I'm not noticing something or this code doesn't work for arrays. Perhaps if input was in a certain format, it would have gotten converted to array earlier on? However, I see no evidence of this in several functions that deal with input parameters before this part.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.