Skip to content

Commit 070b74d

Browse files
authored
chore: use JSON_UNESCAPED_SLASHES (#375)
1 parent 073a98a commit 070b74d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/JWT.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,12 @@ public static function jsonDecode($input)
333333
*/
334334
public static function jsonEncode($input)
335335
{
336-
$json = \json_encode($input);
336+
if (PHP_VERSION_ID >= 50400) {
337+
$json = \json_encode($input, \JSON_UNESCAPED_SLASHES);
338+
} else {
339+
// PHP 5.3 only
340+
$json = \json_encode($input);
341+
}
337342
if ($errno = \json_last_error()) {
338343
static::handleJsonError($errno);
339344
} elseif ($json === 'null' && $input !== null) {

0 commit comments

Comments
 (0)