I'm sending the following json: {"name":"New event"}
to a PATCH handler: function patch($id, $request_data = NULL)
but am getting the following warning: Warning: strlen() expects parameter 1 to be string, array given in /public_html/vendor/Luracast/Restler/Data/Validator.php on line 115
The source at that line is:
switch ($info->type) {
...
case 'string' :
$r = strlen($input);
So I added some code to the first line of Validator.validate() see what it thinks the variables are:
print("$input: $info->type\n");
and I get this:
1: int
Array: string
So it thinks the array is a string. It is still able to continue and process the request, but it returns this warning as the response instead of something valid I can process.
Any ideas what I'm doing wrong?
v3分支中的最新版本(Restler 3 RC4)修复了此问题
I had this problem too, but that's because I gave param
wrong type.
For example
@param string $request_data
change type
string to mixed
the problem will be solved.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.