Skip to content

Stdlib: MessageFormatter invalid pattern → null + IntlException (#22577) - #22766

Merged
PurHur merged 1 commit into
masterfrom
agent/ext-io-22577-msgfmt-create-bad
Jul 24, 2026
Merged

Stdlib: MessageFormatter invalid pattern → null + IntlException (#22577)#22766
PurHur merged 1 commit into
masterfrom
agent/ext-io-22577-msgfmt-create-bad

Conversation

@PurHur

@PurHur PurHur commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Reject unmatched MessageFormat braces at create / __construct / setPattern (php-src ext/intl/msgformat/msgformat_create.c, ICU U_UNMATCHED_BRACES).
  • MessageFormatter::create / msgfmt_create return null (not false); __construct throws IntlException with the Zend message.
  • Idle intl_get_error_message() is U_ZERO_ERROR when code is 0 (php-src intl_error.c).
  • Wire IntlException via ThrowableManifest (gated on host intl) + VM catch bridge; PHP-in-PHP only.

Closes #22577

php-src reference

  • ext/intl/msgformat/msgformat_create.c
  • ext/intl/intl_error.c

Test plan

  • Zend vs VM repro (with php8.2-intl installed in Docker):
    idle_msg='U_ZERO_ERROR' / create null / code 65801 / construct IntlException
    
  • vendor/bin/phpunit --filter 'msgfmt_create_unmatched_braces|intl_error_functions' (VM + JIT for new case)
  • IntlModuleTest::test_messageformatter_invalid_pattern_create_null_construct_throws
  • php script/bootstrap-inventory.php --check → OK 6506/6506
  • php script/check-selfhost-spine-coverage-sync.php → OK

Pillar 1 note (pre-claim)

Made with Cursor

Reject unmatched MessageFormat braces at create/construct like php-src
(umsg_open / U_UNMATCHED_BRACES), return null from create/msgfmt_create,
throw IntlException from __construct, and idle intl_get_error_message as
U_ZERO_ERROR.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 5fa2724 into master Jul 24, 2026
1 check failed
@PurHur
PurHur deleted the agent/ext-io-22577-msgfmt-create-bad branch July 24, 2026 02:14
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: MessageFormatter::create('{invalid') returns dead object — Zend null + IntlException/U_UNMATCHED_BRACES (ext/intl/msgformat)

1 participant