halaxa / json-machine

Efficient, easy-to-use, and fast PHP JSON stream parser
Apache License 2.0
1.08k stars 65 forks source link

Unexpected symbol with Items::fromStream #99

Open andus4n opened 1 year ago

andus4n commented 1 year ago

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

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 commented 1 year ago

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 commented 1 year ago

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