Skip to content

Commit a52640e

Browse files
authored
- Added JSON_INVALID_UTF8_SUBSTITUTE to json_encode in the JsonResponse class to fix non utf-8 characters issues (#1)
- Raised php version
1 parent 89c5931 commit a52640e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}
1010
],
1111
"require": {
12-
"php": ">=7.1",
12+
"php": ">=7.2",
1313
"ext-json": "*",
1414
"packaged/helpers": "^1.9||^2.0",
1515
"packaged/config": "^1.2",

src/Responses/JsonResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ class JsonResponse extends Response
77
{
88
public static function create($object = null, $status = 200, $headers = [])
99
{
10-
return static::raw(json_encode($object), $status, $headers);
10+
return static::raw(json_encode($object, JSON_INVALID_UTF8_SUBSTITUTE), $status, $headers);
1111
}
1212

1313
public static function prefixed($object = null, $status = 200, $headers = [], $prefix = ')]}\'')
1414
{
15-
return static::raw($prefix . json_encode($object), $status, $headers);
15+
return static::raw($prefix . json_encode($object, JSON_INVALID_UTF8_SUBSTITUTE), $status, $headers);
1616
}
1717

1818
public static function p($responseKey, $object, $status = 200, $headers = [])
1919
{
20-
$responseObject = json_encode($object);
20+
$responseObject = json_encode($object, JSON_INVALID_UTF8_SUBSTITUTE);
2121
return static::raw("{$responseKey}({$responseObject})", $status, $headers);
2222
}
2323

0 commit comments

Comments
 (0)