Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ext/json/tests/009.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ echo "Done\n";
--EXPECT--
string(7) "[1,2,3]"
Done

4 changes: 2 additions & 2 deletions ext/json/tests/bug72787.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Bug #72787 (json_decode reads out of bounds)
try {
var_dump(json_decode('[]', false, 0x100000000));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}

?>
--EXPECTF--
json_decode(): Argument #3 ($depth) must be less than %d
ValueError: json_decode(): Argument #3 ($depth) must be less than %d
4 changes: 2 additions & 2 deletions ext/json/tests/bug73113.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ $obj = new JsonSerializableObject();
try {
echo json_encode($obj);
} catch (\Exception $e) {
echo $e->getMessage();
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
This error is expected
Exception: This error is expected
4 changes: 2 additions & 2 deletions ext/json/tests/json_decode_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ echo "\n-- Testing json_decode() function with depth below 0 --\n";
try {
var_dump(json_decode('"abc"', true, -1));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}

?>
--EXPECT--
*** Testing json_decode() : error conditions ***

-- Testing json_decode() function with depth below 0 --
json_decode(): Argument #3 ($depth) must be greater than 0
ValueError: json_decode(): Argument #3 ($depth) must be greater than 0
4 changes: 2 additions & 2 deletions ext/json/tests/json_last_error_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ var_dump(json_last_error());
try {
var_dump(json_last_error(true));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
int(0)
json_last_error() expects exactly 0 arguments, 1 given
ArgumentCountError: json_last_error() expects exactly 0 arguments, 1 given
4 changes: 2 additions & 2 deletions ext/json/tests/json_last_error_msg_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ var_dump(json_last_error_msg());
try {
var_dump(json_last_error_msg(true));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
string(8) "No error"
json_last_error_msg() expects exactly 0 arguments, 1 given
ArgumentCountError: json_last_error_msg() expects exactly 0 arguments, 1 given
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,3 @@ Error on line 7, column 1:
bool(false)
int(4)
string(30) "Syntax error near location 7:1"

@NickSdot NickSdot Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (and following) removes useless second empty line.

4 changes: 2 additions & 2 deletions ext/json/tests/json_validate_003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ json_validate() - Error handling for max depth
try {
var_dump(json_validate("-", PHP_INT_MAX));
} catch (ValueError $error) {
echo $error->getMessage() . PHP_EOL;
echo $error::class, ': ', $error->getMessage(), PHP_EOL;
var_dump(json_last_error(), json_last_error_msg());
}

?>
--EXPECTF--
json_validate(): Argument #2 ($depth) must be less than %d
ValueError: json_validate(): Argument #2 ($depth) must be less than %d
int(0)
string(8) "No error"
Loading