Skip to content

Garbled success example  #5

@yairpe

Description

@yairpe

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions