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
{{ message }}
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.
The call to $this->request->query->all() will always return an array - so far so good. But, in the case of a JSON request payload, the return type of getInput() can be anything that json_decode returns (and is under the control of the client):
// in getInput()if (is_array($parsed = json_decode($this->request->getContent(), true))) {
return$parsed;
}
While some versions of JSON (e.g. https://tools.ietf.org/html/rfc4627: "A JSON text is a serialized object or array") specify that a JSON document must contain an object or array, PHP's json_decode has never followed this. So, the return value of json_decode() can be a bool, string, float, int, etc.
Using the + operator between a string and array causes a warning. Using the + operator between an int and array causes a fatal error:
In
SilexRequest
, this library does the following:The call to
$this->request->query->all()
will always return anarray
- so far so good. But, in the case of a JSON request payload, the return type ofgetInput()
can be anything thatjson_decode
returns (and is under the control of the client):While some versions of JSON (e.g. https://tools.ietf.org/html/rfc4627: "A JSON text is a serialized object or array") specify that a JSON document must contain an object or array, PHP's
json_decode
has never followed this. So, the return value ofjson_decode()
can be a bool, string, float, int, etc.Using the
+
operator between a string and array causes a warning. Using the+
operator between an int and array causes a fatal error:The text was updated successfully, but these errors were encountered: