Documentation
¶
Overview ¶
Package shared holds PHP behaviour that runner and stdlib both need.
stdlib imports runner, never the reverse, so a behaviour both perform has nowhere to live in either. Form decoding is the case: runner builds $_GET and $_POST, parse_str() does the same to a string, and the two have to agree.
Only that. A helper stdlib alone needs belongs in internal/phpval; one only runner needs belongs in runner.
Index ¶
Constants ¶
const ( DefaultMaxNesting = 64 DefaultMaxVars = 1000 )
Variables ¶
This section is empty.
Functions ¶
func ParsePairs ¶
ParsePairs is ParseStr for input that arrived as pairs: multipart values and the cookie header. Order is the order they are applied in, which decides the result when two name the same variable.
func ParseStr ¶
ParseStr decodes an application/x-www-form-urlencoded string into the nested array PHP builds from it. It backs parse_str(), $_GET and $_POST.
Decoding happens before the brackets are read, so `k%5Ba%20b%5D=1` nests under the key `a b`.
func RawURLDecode ¶
RawURLDecode decodes an RFC 3986 string: as URLDecode, but `+` is a plus.
Types ¶
type Limits ¶
type Limits struct {
// MaxNesting is php.ini's max_input_nesting_level. A variable past it is
// dropped whole rather than truncated.
MaxNesting int
// MaxVars is php.ini's max_input_vars.
MaxVars int
}
Limits bounds what a hostile form can build. A zero field means PHP's default; negative means no limit.