Skip to content

Commit 66c712d

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 1fae8c4 commit 66c712d

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
@@ -314,7 +314,7 @@ public static function jsonDecode($input)
314314
*/
315315
public static function jsonEncode($input)
316316
{
317-
$json = \json_encode($input);
317+
$json = \json_encode($input, JSON_UNESCAPED_SLASHES);
318318
if ($errno = \json_last_error()) {
319319
static::handleJsonError($errno);
320320
} elseif ($json === 'null' && $input !== null) {

0 commit comments

Comments
 (0)