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

Unexpected symbol with Items::fromStream #99

Open
andus4n opened this issue May 12, 2023 · 2 comments
Open

Unexpected symbol with Items::fromStream #99

andus4n opened this issue May 12, 2023 · 2 comments

Comments

@andus4n
Copy link

andus4n commented May 12, 2023

Hi.
I have a weird issue with this library...maybe i'm doing something wrong, but in short:

  • i'm downloading a large json file with CURLOPT_FILE set to php://temp (w+)
  • pointer set to "/items"
  • when using Items::fromStream() i'm getting an error (Unexpected symbol 'L"},{"image":"https' At position 0)

If i change my logic and use a file (created with tmpfile()) instead of php://temp everything works fine (in this case i'm using Items::fromFile(stream_get_meta_data($handler)['uri])

Any idea?

@halaxa
Copy link
Owner

halaxa commented May 13, 2023

Please provide the full php code and at least a part of the json file to reproduce this. It might also be that the json is actually corrupted. Try enabling debug mode and check the position in json file where it crashes.

@andus4n
Copy link
Author

andus4n commented May 13, 2023

sure, i'm attaching a overly-simplified emulated version of the code and the "*.json" file as well.
also, i'm attaching two screenshots with de working/not-working versions.
I have to mention, that the "fromStream" version would work if i'd get rid of the validation block.

error
ok
project.zip

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

2 participants