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