1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 22:41:20 +02:00
Files
archived-php-src/ext/json/tests/bug73991.phpt
Sara Golemon aa2282df21 Allow JSON_OBJECT_AS_ARRAY option to actually have meaning
Options can only be passed if $assoc is passed, but passing
assoc clobbers any attempt to pass JSON_OBJECT_AS_ARRAY as an
option.

Allow the option to occur in the options field by handling
"null" as default/use-options.
2017-03-17 15:36:24 -07:00

29 lines
490 B
PHP

--TEST--
Allow JSON_OBJECT_AS_ARRAY to have an effect
--FILE--
<?php
$json = '{"foo":"bar"}';
var_dump(json_decode($json, false));
var_dump(json_decode($json, true));
var_dump(json_decode($json, null, 512, 0));
var_dump(json_decode($json, null, 512, JSON_OBJECT_AS_ARRAY));
--EXPECTF--
object(stdClass)#%d (1) {
["foo"]=>
string(3) "bar"
}
array(1) {
["foo"]=>
string(3) "bar"
}
object(stdClass)#%d (1) {
["foo"]=>
string(3) "bar"
}
array(1) {
["foo"]=>
string(3) "bar"
}