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

response()->json() fails as it incorrectly interprets spatial fields #34

Closed
lukepower opened this issue Apr 26, 2022 · 8 comments
Closed

Comments

@lukepower
Copy link

When returning a collection with some spatial fields in it (in our case, all Point's) like this:

return response()->json($res);

We get a 500 error on the server with "Malformed UTF-8 characters, possibly incorrectly encoded".
As soon as I null the spatial field in the DB, the error dissolves. It seemingly is unable to correctly create a json out of the field.
Using latest Laravel 9 and current master.

@MatanYadaev
Copy link
Owner

@lukepower Can you please help me to reproduce the issue by forking this repo and creating a PR with a failing test? Or provide a link to a new Laravel repo that has this issue?

@lukepower
Copy link
Author

@MatanYadaev Just came back from vacation, will do it asap.
Just a quick note, it seems that when I access the spatial field I get the binary data, i.e. like this:

��b1E�� ���%ǝ��?

I guess something is wrong with the way I set up the whole package...

@Synchro
Copy link
Contributor

Synchro commented Jun 24, 2022

That's the same bug as in #28, which I've still been unable to solve.

@mostafaznv
Copy link

mostafaznv commented Jun 24, 2022

This issue happens when someone wants to see changes of a record (getChanges, isDirty and ...).

For example, In Nova 4 there is a feature to log all changes of model's records.
when it wants to log changed and original values into database, this error happens.

@MatanYadaev
Copy link
Owner

Should be fixed in version 2. Please check it.

@devinfd
Copy link
Contributor

devinfd commented Sep 6, 2022

Just FYI I'm using v2.2 and still getting a Unable to JSON encode payload. Error code: 5

@MatanYadaev
Copy link
Owner

Hi @devinfd, please respect my time, if you want me to fix the issue, make it easy to me to reproduce it. It will be best if you'll create a fork of this repo with a failing test, or a Laravel app repo that has a broken endpoint.
I wasn't able to reproduce the issue.

@devinfd
Copy link
Contributor

devinfd commented Sep 6, 2022

Of course @MatanYadaev. I'm am currently debugging my issue to make sure that it's an issue on my end. I made the above comment because in your previous comment you said "Please check it." So I thought you would want the feedback.

Awesome package! Glad to see that it's well cared for.

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

No branches or pull requests

5 participants