Skip to content

Commit b5051e9

Browse files
authored
Merge pull request #80 from 4513/main
2 parents 40edd32 + 4dfed80 commit b5051e9

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/Saver/FileSaver.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ public function isSupported()
1919

2020
public function save(array $data)
2121
{
22-
$json = json_encode($data);
22+
$json = json_encode($data, PHP_VERSION_ID >= 70200 ? JSON_INVALID_UTF8_IGNORE : 0);
23+
24+
if ($json === false) {
25+
return false;
26+
}
2327

2428
return file_put_contents($this->file, $json . PHP_EOL, FILE_APPEND);
2529
}

src/Saver/UploadSaver.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ public function isSupported()
2828

2929
public function save(array $data)
3030
{
31-
$json = json_encode($data);
31+
$json = json_encode($data, PHP_VERSION_ID >= 70200 ? JSON_INVALID_UTF8_IGNORE : 0);
32+
33+
if ($json === false) {
34+
return false;
35+
}
36+
3237
$this->submit($this->url, $json);
3338

3439
return true;

0 commit comments

Comments
 (0)