Skip to content

Stdlib: NumberFormatter::parse U_PARSE_ERROR without global pollution (#22855)#22975

Merged
PurHur merged 1 commit into
masterfrom
fix/22855-numfmt-parse-error-code
Jul 25, 2026
Merged

Stdlib: NumberFormatter::parse U_PARSE_ERROR without global pollution (#22855)#22975
PurHur merged 1 commit into
masterfrom
fix/22855-numfmt-parse-error-code

Conversation

@PurHur

@PurHur PurHur commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Failed NumberFormatter::parse / parseCurrency now set object error 9 (U_PARSE_ERROR) with Zend message Number parsing failed: U_PARSE_ERROR (no numfmt_parse: prefix).
  • Global intl_get_error_code() stays 0 (object-only failure path).

Closes #22855

php-src reference

  • ext/intl/formatter/formatter_main.c — parse status / error reporting

PHP implementation

  • ext/intl/VmNumberFormatter.phpfailParse()

Test plan

  • php bin/vm.php test/repro/issue_22855_numfmt_parse_error.php → false / 9 / Number parsing failed… / 0
  • vendor/bin/phpunit --filter numberformatter_parse_error (+ related parse) → OK (8)

Batch: #22870 + #22877 merged; this is #3.

Made with Cursor

… pollution (#22855)

Match php-src: object error code 9 and message without numfmt_parse: prefix;
leave intl_get_error_code() at 0 after a failed parse.

Co-authored-by: Cursor <cursoragent@cursor.com>
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: NumberFormatter::parse() error code 1 not U_PARSE_ERROR (9); pollutes intl_get_error_code (ext/intl/formatter)

1 participant