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

Garbled success example #5

Open
yairpe opened this issue Jun 6, 2017 · 1 comment
Open

Garbled success example #5

yairpe opened this issue Jun 6, 2017 · 1 comment

Comments

@yairpe
Copy link

yairpe commented Jun 6, 2017

Nice and handy extension. Thanks.

I believe there's a bug that removes repeating lines from the success example and thus generates illegal json structure

The code which inserts the output is:

     * @param $str string Insert one row in output.
     */
    private function insert($str)
    {
        if(array_search($str, $this->out) === false)
        {
            $this->out[] = $str;
        }
    }

Now, because of the check for duplicates strings lines are removed.
I'm pretty sure there was good reason to add this check but the fact is that it garbles the output

For example (I've numbered the lines just for the explanation)
Now lines 6 and 9 are not inserted to the output because the are a duplicate of lines 2 and 5.

1  [
2      {
3          "id": 123,
4          "deleted": null
5      },
6      {
7          "id": 456,
8          "deleted": null
9      },
10 ]

So the output becomes:

1  [
2      {
3          "id": 123,
4          "deleted": null
5      },
7          "id": 456,
8          "deleted": null
10 ]

Removing the check creates a good leagal outout

@enryold
Copy link
Owner

enryold commented Jun 8, 2017

Thank you @yairpe.
Currently i have no time to fix, but would be great if you can do it :)

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