Skip to content

Fix number_format() enum TypeError arg indices (#8795) - #10619

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-8795-number-format-enum-jit
Jun 22, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-8795-number-format-enum-jit

Conversation

@PurHur

@PurHur PurHur commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix off-by-one TypeError argument numbers for number_format() $decimal_separator and $thousands_separator when enum cases are passed (VM + JIT).
  • Root cause: VmString / JitStringBuiltinArg use 0-based arg indices (+1 in messages) while VmMath / JitIntdiv use 1-based indices — string params were incorrectly using the int convention.
  • Add maintainer repro test/repro/maintainer_number_format_enum_typeerror.php.

php-src reference

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php test/repro/maintainer_number_format_enum_typeerror.php
php bin/jit.php test/repro/maintainer_number_format_enum_typeerror.php
php vendor/bin/phpunit --filter number_format_enum
'

Output:

decimals: number_format(): Argument #2 ($decimals) must be of type int, E given
decimal_separator: number_format(): Argument #3 ($decimal_separator) must be of type ?string, E given
OK (4 tests, 4 assertions)

Closes #8795

Made with Cursor

VmString/JitStringBuiltinArg use 0-based arg indices (+1 in messages) while VmMath/JitIntdiv use 1-based; align decimal/thousands separator guards with Zend (#8795).

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit cf8a3c6 into master Jun 22, 2026
@PurHur
PurHur deleted the agent/issue-8795-number-format-enum-jit branch June 22, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: number_format() — enum case operand coerces not TypeError (re-#5892, number_format.c)

1 participant