summaryrefslogtreecommitdiff
path: root/ext/json/tests/bug68546.phpt
blob: f8c8d135f3a3bf9e78f877f1c8d6f2ac1ed7c47a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--TEST--
Bug #68546 (json_decode() Fatal error: Cannot access property started with '\0')
--SKIPIF--
<?php

if (!extension_loaded('json')) die('skip');
?>
--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, "\u0000": 1}]'));
var_dump(json_last_error() === JSON_ERROR_INVALID_PROPERTY_NAME);
var_dump(json_last_error_msg());

echo "Done\n";
?>
--EXPECTF--
NULL
bool(true)
NULL
bool(true)
string(36) "The decoded property name is invalid"
Done