json-machine
json-machine copied to clipboard
Unexpected symbol with Items::fromStream
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?
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.
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.