xref: /PHP-8.4/ext/json/tests/bug68546.phpt (revision 32a1ebbd)
1--TEST--
2Bug #68546 (json_decode() Fatal error: Cannot access property started with '\0')
3--FILE--
4<?php
5
6var_dump(json_decode('{"key": {"\u0000": "aa"}}'));
7var_dump(json_last_error() === JSON_ERROR_INVALID_PROPERTY_NAME);
8var_dump(json_decode('[{"key1": 0, "\u0000": 1}]'));
9var_dump(json_last_error() === JSON_ERROR_INVALID_PROPERTY_NAME);
10var_dump(json_last_error_msg());
11
12echo "Done\n";
13?>
14--EXPECT--
15NULL
16bool(true)
17NULL
18bool(true)
19string(36) "The decoded property name is invalid"
20Done
21