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

Fix replaceValue method crash when paylod is just a string #56

Merged
merged 1 commit into from
Mar 10, 2021

Conversation

emilianotisato
Copy link
Contributor

@emilianotisato emilianotisato commented Mar 6, 2021

In all cases we are assuming that the response payload to pars with Styde\Enlighten\Models\ReplacesValues trait is either null or an object/array. But when we are returning just a plain string like:

        return response()->json('Unsubscription was successfully', 200);

Then we get an exception coz array_intersect_key can't use the string (see attached image).

This fix will return the plain string response if we cant json decode it.
Fixes #55

@emilianotisato emilianotisato changed the title Fix convert replaceValue method crash when paylod is just a string Fix replaceValue method crash when paylod is just a string Mar 6, 2021
@sileence sileence merged commit cab4ede into StydeNet:main Mar 10, 2021
@sileence
Copy link
Member

sileence commented Mar 10, 2021

@emilianotisato thanks for the PR! Please also send a test next time. I just added one for this fix.

sileence added a commit that referenced this pull request Mar 10, 2021
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.

Exception thrown when response payload is a plain string.
2 participants