← All changes
|
extensions/blocks/premium-content/_inc/subscription-service/class-jwt.php
+6
-4
13.7.2
→
16.3-beta
View file →
| @@ -12,8 +12,12 @@ | ||
| 12 | 12 | use DomainException; |
| 13 | 13 | use InvalidArgumentException; |
| 14 | 14 | use UnexpectedValueException; |
| 15 | 15 | |
| 16 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 17 | + exit( 0 ); | |
| 18 | +} | |
| 19 | + | |
| 16 | 20 | /** |
| 17 | 21 | * JSON Web Token implementation, based on this spec: |
| 18 | 22 | * https://tools.ietf.org/html/rfc7519 |
| 19 | 23 | * |
| @@ -319,9 +323,9 @@ | ||
| 319 | 323 | * |
| 320 | 324 | * @throws DomainException Provided object could not be encoded to valid JSON. |
| 321 | 325 | */ |
| 322 | 326 | public static function json_encode( $input ) { |
| 323 | - $json = wp_json_encode( $input ); | |
| 327 | + $json = wp_json_encode( $input, JSON_UNESCAPED_SLASHES ); | |
| 324 | 328 | $errno = json_last_error(); |
| 325 | 329 | |
| 326 | 330 | if ( $errno ) { |
| 327 | 331 | static::handle_json_error( $errno ); |
| @@ -376,11 +380,9 @@ | ||
| 376 | 380 | JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON', |
| 377 | 381 | JSON_ERROR_UTF8 => 'Malformed UTF-8 characters', |
| 378 | 382 | ); |
| 379 | 383 | throw new DomainException( |
| 380 | - isset( $messages[ $errno ] ) | |
| 381 | - ? $messages[ $errno ] | |
| 382 | - : 'Unknown JSON error: ' . $errno | |
| 384 | + $messages[ $errno ] ?? 'Unknown JSON error: ' . $errno | |
| 383 | 385 | ); |
| 384 | 386 | } |
| 385 | 387 | |
| 386 | 388 | /** |