Skip to content

Commit 0835d8f

Browse files
committed
Use json_encode with option JSON_UNESCAPED_SLASHES
When encoding JSON, use option JSON_UNESCAPED_SLASHES which allows to disable a non-standard unnecessary over-encoding of '/' as '\/' by json_encode. This option of json_encode is available on PHP 5.4+.
1 parent 9af3b99 commit 0835d8f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
],
2121
"license": "BSD-3-Clause",
2222
"require": {
23-
"php": ">=5.3.0"
23+
"php": ">=5.4.0"
2424
},
2525
"autoload": {
2626
"psr-4": {

src/JWT.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ public static function jsonDecode($input)
322322
*/
323323
public static function jsonEncode($input)
324324
{
325-
$json = \json_encode($input);
325+
$json = \json_encode($input, JSON_UNESCAPED_SLASHES);
326326
if ($errno = \json_last_error()) {
327327
static::handleJsonError($errno);
328328
} elseif ($json === 'null' && $input !== null) {

0 commit comments

Comments
 (0)