8000 Use PHP native json_validate in isJson function if available (#48367) · laravel/framework@a02a39b · GitHub
[go: up one dir, main page]

Skip to content

Commit a02a39b

Browse files
authored
Use PHP native json_validate in isJson function if available (#48367)
1 parent 6d29fad commit a02a39b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Illuminate/Support/Str.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,10 @@ public static function isJson($value)
452452
return false;
453453
}
454454

455+
if (function_exists('json_validate')) {
456+
return json_validate($value, 512);
457+
}
458+
455459
try {
456460
json_decode($value, true, 512, JSON_THROW_ON_ERROR);
457461
} catch (JsonException) {

0 commit comments

Comments
 (0)
0