Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Core/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function decode($values): mixed
}
//$value = (string) $value;
if ($this->isNumeric()) {
return $this;
return $this->value;
}
else if ($this->isString()) {
$prefix = $this->getStringPrefix();
Expand Down
13 changes: 13 additions & 0 deletions tests/CompressJsonBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,17 @@ public function testSecondValueAsNumericalString()
// Assert
$this->assertEquals($data, $decompressed);
}

public function testNumericalStringDecompressJson()
{
//raw json
$rawJson = '["0"]';
//compress-json.js generated compressed json
$compressedJson = '[["0","a|0"],"1"]';
$data=json_decode($rawJson,true);
$decompressed = Compressor::create()
->decompressJson($compressedJson);
// Assert
$this->assertSame($data, $decompressed);
}
}