Fix handling of empty arrays and objects

pull/3/head
Markus Mittendrein 2020-08-15 18:23:49 +02:00
parent 4193dbb96c
commit 8607a7f516
1 changed files with 8 additions and 0 deletions

View File

@ -47,6 +47,10 @@ class JSONStream
$this->offset++;
$this->skipWhitespace();
$st = $this->buffer[$this->offset] === '}' ? 2 : 1;
if ($st == 2)
{
$this->offset++;
}
$this->in[] = [ $st, self::OBJ, NULL, false ];
}
@ -64,6 +68,10 @@ class JSONStream
$this->offset++;
$this->skipWhitespace();
$st = $this->buffer[$this->offset] === ']' ? 2 : 1;
if ($st == 2)
{
$this->offset++;
}
$this->in[] = [ $st, self::ARR, NULL, false ];
}