Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] PHP Warning: substr() expects parameter 1 to be string, array given #562

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from

Conversation

soda-2005
Copy link

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

@Arul-
Copy link
Member

Arul- commented Jan 12, 2017

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

@scelt
Copy link

scelt commented Jan 12, 2017

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-?

@Arul-
Copy link
Member

Arul- commented Jan 16, 2017

@scelt Good Catch! Will come up with a way to handle that!

@vdespa vdespa deleted the v3 branch May 15, 2017 11:10
…rray given in Restler/Data/Text.php line 63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants