Skip to content

Commit a8eef4d

Browse files
committed
chore: use JSON_UNESCAPLE_SLASHES
1 parent 86d8310 commit a8eef4d

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

.github/workflows/tests.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,6 @@ jobs:
5252
with:
5353
entrypoint: ./.github/actions/entrypoint.sh
5454

55-
test_php53:
56-
name: "PHP 5.3 Unit Test"
57-
runs-on: ubuntu-latest
58-
steps:
59-
- name: Checkout
60-
uses: actions/checkout@v2
61-
- name: Run Unit Tests
62-
uses: docker://tomsowerby/php-5.3:cli
63-
with:
64-
entrypoint: ./.github/actions/entrypoint.sh
65-
6655
style:
6756
runs-on: ubuntu-latest
6857
name: PHP Style Check

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
"suggest": {
2626
"paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"

src/JWT.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public static function jsonDecode($input)
330330
*/
331331
public static function jsonEncode($input)
332332
{
333-
$json = \json_encode($input);
333+
$json = \json_encode($input, \JSON_UNESCAPED_SLASHES);
334334
if ($errno = \json_last_error()) {
335335
static::handleJsonError($errno);
336336
} elseif ($json === 'null' && $input !== null) {
@@ -445,7 +445,7 @@ private static function handleJsonError($errno)
445445
JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON',
446446
JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
447447
JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON',
448-
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters' //PHP >= 5.3.3
448+
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters'
449449
);
450450
throw new DomainException(
451451
isset($messages[$errno])

0 commit comments

Comments
 (0)