Category
stdlib / runtime
Problem
Since PHP 8.0, parse_str() requires two arguments ($encoded_string, &$result). The one-argument form that imported variables into the local symbol table was removed.
This compiler still accepts one argument at main-script scope and imports query vars into the caller frame (ext/standard/parse_str.php + VmScope::requireMainScriptForParseStrOneArg). Zend throws ArgumentCountError everywhere, including top-level scripts.
php-src reference
Repro (today)
test/repro-maintainer/parse_str_function_scope.php:
./script/docker-exec.sh -- bash -lc 'php test/repro-maintainer/parse_str_function_scope.php'
# ArgumentCountError on line 11 (script-level one-arg)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro-maintainer/parse_str_function_scope.php'
# y:home:y:3 ← script-level one-arg still imports $route/$page (wrong)
Inline check:
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "parse_str(\"x=1\"); echo isset(\$x)?\$x:\"no\";"'
# 1 ← should throw ArgumentCountError
Scope (this repo)
| Module |
Path |
| VM |
ext/standard/parse_str.php, ext/standard/VmScope.php, ext/standard/VmParseStr.php |
| JIT |
ext/standard/JitParseStr.php — remove main-script one-arg exception |
| Tests |
update test/repro-maintainer/parse_str_function_scope.php; add compliance PHPT |
Done when
Related
Category
stdlib/runtimeProblem
Since PHP 8.0,
parse_str()requires two arguments ($encoded_string,&$result). The one-argument form that imported variables into the local symbol table was removed.This compiler still accepts one argument at main-script scope and imports query vars into the caller frame (
ext/standard/parse_str.php+VmScope::requireMainScriptForParseStrOneArg). Zend throwsArgumentCountErroreverywhere, including top-level scripts.php-src reference
ext/standard/basic_functions.c—PHP_FUNCTION(parse_str)arity checkext/standard/basic_functions.stub.php—#[\Deprecated]removal of 1-arg overloadRepro (today)
test/repro-maintainer/parse_str_function_scope.php:Inline check:
Scope (this repo)
ext/standard/parse_str.php,ext/standard/VmScope.php,ext/standard/VmParseStr.phpext/standard/JitParseStr.php— remove main-script one-arg exceptiontest/repro-maintainer/parse_str_function_scope.php; add compliance PHPTDone when
parse_str()throws catchableArgumentCountErrorin functions and at main script scope (VM/JIT/AOT)$resultarray and returnstrue./script/ci-fast.sh --filter parse_strgreenRelated
$paramsarray in modern PHP