Skip to content

Commit

Permalink
Optimized Model/JsonResource::toJson (#6963)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangdijia authored Jul 22, 2024
1 parent faad00e commit f043382
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Cursor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace Hyperf\Paginator;

use Hyperf\Contract\Arrayable;
use JsonException;
use UnexpectedValueException;

use function Hyperf\Collection\collect;
Expand Down Expand Up @@ -95,9 +96,9 @@ public static function fromEncoded(?string $encodedString): ?static
return null;
}

$parameters = json_decode(base64_decode(str_replace(['-', '_'], ['+', '/'], $encodedString)), true);

if (json_last_error() !== JSON_ERROR_NONE) {
try {
$parameters = json_decode(base64_decode(str_replace(['-', '_'], ['+', '/'], $encodedString)), true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
return null;
}

Expand Down

0 comments on commit f043382

Please sign in to comment.