xref: /PHP-8.1/ext/json/tests/bug73991.phpt (revision 32a1ebbd)
1--TEST--
2Allow JSON_OBJECT_AS_ARRAY to have an effect
3--FILE--
4<?php
5
6$json = '{"foo":"bar"}';
7
8var_dump(json_decode($json, false));
9var_dump(json_decode($json, true));
10var_dump(json_decode($json, null, 512, 0));
11var_dump(json_decode($json, null, 512, JSON_OBJECT_AS_ARRAY));
12?>
13--EXPECTF--
14object(stdClass)#%d (1) {
15  ["foo"]=>
16  string(3) "bar"
17}
18array(1) {
19  ["foo"]=>
20  string(3) "bar"
21}
22object(stdClass)#%d (1) {
23  ["foo"]=>
24  string(3) "bar"
25}
26array(1) {
27  ["foo"]=>
28  string(3) "bar"
29}
30