1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 16:52:18 +01:00
Files
archived-php-src/ext/json/tests/bug68546.phpt
Juan Morales b80ffc5b2e Json last error msg/error message with location error (#20629)
This slightly extend error messages with locations taken from scanner / parser
2026-01-03 18:34:19 +01:00

21 lines
525 B
PHP

--TEST--
Bug #68546 (json_decode() Fatal error: Cannot access property started with '\0')
--FILE--
<?php
var_dump(json_decode('{"key": {"\u0000": "aa"}}'));
var_dump(json_last_error() === JSON_ERROR_INVALID_PROPERTY_NAME);
var_dump(json_decode('[{"key1": 0, "\u1234": 1, "\u0000": 1}]'));
var_dump(json_last_error() === JSON_ERROR_INVALID_PROPERTY_NAME);
var_dump(json_last_error_msg());
echo "Done\n";
?>
--EXPECT--
NULL
bool(true)
NULL
bool(true)
string(55) "The decoded property name is invalid near location 1:27"
Done