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