You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
json_encode($value, flags: JSON_FORCE_OBJECT) fails at compile/runtime with Too many arguments to function call. Positional json_encode($value, JSON_FORCE_OBJECT) works. Zend accepts the named flags: parameter.
Category
stdlib· php-src-strictProblem
json_encode($value, flags: JSON_FORCE_OBJECT)fails at compile/runtime with Too many arguments to function call. Positionaljson_encode($value, JSON_FORCE_OBJECT)works. Zend accepts the namedflags:parameter.php-src reference
ext/json/php_json.c—php_json_encode(),$flagsparameterext/json/php_json.h—JSON_FORCE_OBJECTand related flagsRepro
test/repro/maintainer_gap_json_encode_flags_named.php:Zend:
'{"a":1}'VM:
Too many arguments to function callImplementation hints (PHP-in-PHP)
json_encodeinBuiltinParamNameswithflags(and optionaldepth) — same pattern as Stdlib: header() — named parameters replace/response_code fail at compile (BuiltinParamNames, head.c) #9104header()named args.ext/standard/ext/jsonVmJson path already handles integer flags once bound.Done when (php-src-strict)
flags:accepted; output matches positional formJSON_THROW_ON_ERRORnamed constant + named arg smoke (pairs Stdlib: json_decode()/json_encode() with JSON_THROW_ON_ERROR must throw JsonException (ext/json/php_json.c) #9032)test/compliance/cases/stdlib/ortest/repro/Related