Category
stdlib
Problem
Zend parse_str($encoded, &$result, $prefix) accepts an optional third argument that prefixes array keys parsed from the query string. This compiler only allows one or two arguments and throws LogicException on three-arg calls.
php-src reference
Repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php -r "\$a=[]; parse_str(\"k=v\", \$a, \"pre_\"); var_export(\$a); echo PHP_EOL;"
php bin/vm.php -r "\$a=[]; parse_str(\"k=v\", \$a, \"pre_\"); var_export(\$a); echo PHP_EOL;"
'
| Runtime |
Result |
| Zend |
array('pre_k' => 'v') |
| VM |
LogicException: parse_str() requires one or two arguments in this compiler build |
Scope
| Area |
Files |
| VM |
ext/standard/parse_str.php, VmParseStr.php |
| JIT |
__compiler_parse_str / JitParseStr if present |
| Tests |
test/compliance/cases/stdlib/parse_str_prefix.phpt |
Complements #4050 (reject deprecated one-arg form).
Done when
Category
stdlibProblem
Zend
parse_str($encoded, &$result, $prefix)accepts an optional third argument that prefixes array keys parsed from the query string. This compiler only allows one or two arguments and throwsLogicExceptionon three-arg calls.php-src reference
ext/standard/basic_functions.c—PHP_FUNCTION(parse_str)(prefix branch)ext/standard/basic_functions.stub.phpRepro
array('pre_k' => 'v')LogicException: parse_str() requires one or two arguments in this compiler buildScope
ext/standard/parse_str.php,VmParseStr.php__compiler_parse_str/JitParseStrif presenttest/compliance/cases/stdlib/parse_str_prefix.phptComplements #4050 (reject deprecated one-arg form).
Done when
./script/ci-fast.sh --filter parse_str_prefixgreen