Skip to content

Stdlib: number_format() array TypeError compliance guard (#4163) - #18723

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-4163-number-format-type-error
Jul 13, 2026
Merged

Stdlib: number_format() array TypeError compliance guard (#4163)#18723
PurHur merged 1 commit into
masterfrom
agent/issue-4163-number-format-type-error

Conversation

@PurHur

@PurHur PurHur commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

Root cause

Behavior was implemented in ext/standard/VmNumberFormat.php (coerceFloat() default branch via VmParseStr::zendTypeLabel()); issue stayed open without a named PHPUnit/compliance filter.

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php -r "try { number_format([\"x\"]); } catch (Throwable \$e) { echo get_class(\$e),\": \",\$e->getMessage(),PHP_EOL; }"
php bin/vm.php -r "try { number_format([\"x\"]); } catch (Throwable \$e) { echo get_class(\$e),\": \",\$e->getMessage(),PHP_EOL; }"
php bin/jit.php -r "try { number_format([\"x\"]); } catch (Throwable \$e) { echo get_class(\$e),\": \",\$e->getMessage(),PHP_EOL; }"
'
TypeError: number_format(): Argument #1 ($num) must be of type float, array given
TypeError: number_format(): Argument #1 ($num) must be of type float, array given
TypeError: number_format(): Argument #1 ($num) must be of type float, array given
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter number_format_type_error'
OK (4 tests, 4 assertions)

Closes #4163

Made with Cursor

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 0fa0c71 into master Jul 13, 2026
@PurHur
PurHur deleted the agent/issue-4163-number-format-type-error branch July 13, 2026 21:22
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.

Stdlib: number_format() — TypeError when $num is not int/float (ext/standard/number_format.c parity)

1 participant