Restler
Restler copied to clipboard
[BUGFIX] PHP Warning: substr() expects parameter 1 to be string, array given
This bugfix fixes the following PHP-warning: PHP Warning: substr() expects parameter 1 to be string, array given in luracast/restler/vendor/Luracast/Restler/Data/Text.php line 63
is_string($r['type']) should not be needed. If $r['type'] is not a string, problem is some where else and that needs to be fixed
If $r['type'] is not a string, problem is some where else and that needs to be fixed
When there's @param string|array it creates an array out of it (vendor/Luracast/Restler/CommentParser.php:477).
And if you put the is_string($r['type']) into the if clause, @param int|array[]will fail because it will be array but still there is the ending [] (see the last example here: https://www.phpdoc.org/docs/latest/guides/types.html).
I guess that this should be fixed in a way that if $r['type'] is an array, you should use the original type value (for example string|int[]) in the Text::endsWith() as a haystack.
What say you, @Arul-?
@scelt Good Catch! Will come up with a way to handle that!