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 }}
Repository navigation
An internal function called with more arguments than it accepts returns normally instead of throwing ArgumentCountError. #643
ArgumentCountError: strlen() expects exactly 1 argument, 2 given
Actual (manticore 783f6c3c, Darwin arm64)
int(1)
Tracking
Known-bug repro: tests/aot/repro/wrong/internal_fn_surplus_args_no_argcount_error.php — bash tests/aot/xfail.sh -k internal_fn_surplus_args_no_argcount_error reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.
Tried the direct fix (throw ArgumentCountError at the call site when an internal function gets more arguments than its signature declares). It is blocked: 18 stdlib functions declare FEWER parameters than php, so a php-valid call would start throwing — array_keys (1 vs 3), mkdir (3/4), rmdir (1/2), rename (2/3), copy (2/3), file (2/3), readfile (1/3), hash (3/4), hash_file (3/4), file_get_contents (3/5), file_put_contents (3/4), fopen (2/4), unlink (1/2), opendir (1/2), scandir (2/3), strrchr (2/3), str_word_count (2/3), strspn (3/4). Prelude functions were not audited yet. Order: make those signatures php-faithful (AGENTS.md: keep PHP signatures php-faithful), then add the check (emitCall, php-visible global names, non-variadic; arguments evaluated before the throw).
Fixed on branch shared-generics: the 17 stdlib and 6 prelude signatures now declare php's parameters, and the call-site check throws php's ArgumentCountError. One exception by the two-step rule: array_keys keeps its one-parameter declaration (the emitter reads its arguments by count; an older compiler fills defaults into that call). The lowering fix that makes adding them safe is in the same commit; add array_keys($array, $filter_value, $strict) after BOOTSTRAP_VERSION is raised past it.
Activity
blacktrs commentedon Nov 10, 2026
Tried the direct fix (throw ArgumentCountError at the call site when an internal function gets more arguments than its signature declares). It is blocked: 18 stdlib functions declare FEWER parameters than php, so a php-valid call would start throwing — array_keys (1 vs 3), mkdir (3/4), rmdir (1/2), rename (2/3), copy (2/3), file (2/3), readfile (1/3), hash (3/4), hash_file (3/4), file_get_contents (3/5), file_put_contents (3/4), fopen (2/4), unlink (1/2), opendir (1/2), scandir (2/3), strrchr (2/3), str_word_count (2/3), strspn (3/4). Prelude functions were not audited yet. Order: make those signatures php-faithful (AGENTS.md: keep PHP signatures php-faithful), then add the check (emitCall, php-visible global names, non-variadic; arguments evaluated before the throw).
blacktrs commentedon Nov 10, 2026
Fixed on branch shared-generics: the 17 stdlib and 6 prelude signatures now declare php's parameters, and the call-site check throws php's ArgumentCountError. One exception by the two-step rule: array_keys keeps its one-parameter declaration (the emitter reads its arguments by count; an older compiler fills defaults into that call). The lowering fix that makes adding them safe is in the same commit; add array_keys($array, $filter_value, $strict) after BOOTSTRAP_VERSION is raised past it.