-
Notifications
You must be signed in to change notification settings - Fork 132
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
Last Item Ignored #64
Comments
@baoqiangy That's not a problem I've ever had with the parser. Without knowing the specifics, I suspect it's a mistake in your Listener implementation. |
Here is the modified code of the example_geojson.php, I only changed the file to use small_json.json and print the json every time a json is recognized. `<?php require_once '/../vendor/autoload.php'; $testfile = 'small_json.json'; $listener = new \JsonStreamingParser\Listener\GeoJsonListener(function ($item) { Here is the json file I used (small_json.json).
Here is the output when I execute the example_test.php in a browser on localhost. ` Apparently, the last one is not printed. I could not figure out what caused this. |
Got it. I suspect it's a problem with the logic in the Specifically, this logic: // Call the callback when returning to the second level
if ($this->level == 2 && is_callable($this->callback)) {
call_user_func($this->callback, $this->json);
} Since the last element doesn't return to level 2. I don't use the |
I`ve got the same Problem and the same Node has many hits. The Return-Level is 1.
|
I tested a small file with 4 elements in there. I noticed that the last element is always ignored. Is it because you code return an empty element as the first one and by the time the last element is read, the parser simply thinks it is done?
The text was updated successfully, but these errors were encountered: