[php-src] PR #22306: ext/intl: Fix Locale::lookup() fallback on invalid language tags

From: Date: Sun, 14 Jun 2026 15:28:31 +0000
Subject: [php-src] PR #22306: ext/intl: Fix Locale::lookup() fallback on invalid language tags
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-36420@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/22306 Author: LamentXU123 Locale::lookup() and locale_lookup() should return NUL when it fails. Now they returns the fallback locale even when lookup_loc_range() failed and set an intl error. For example: ```php <?php var_dump(Locale::lookup([''], 'de-DE', false, 'en-US')); var_dump(intl_get_error_message()); var_dump(locale_lookup([''], 'de-DE', false, 'en-US')); var_dump(intl_get_error_message()); ?> ``` now returns ``` string(5) "en-US" string(75) "lookup_loc_range: unable to canonicalize lang_tag: U_ILLEGAL_ARGUMENT_ERROR" string(5) "en-US" string(75) "lookup_loc_range: unable to canonicalize lang_tag: U_ILLEGAL_ARGUMENT_ERROR" ``` but I expect: ``` NULL string(75) "lookup_loc_range: unable to canonicalize lang_tag: U_ILLEGAL_ARGUMENT_ERROR" NULL string(75) "lookup_loc_range: unable to canonicalize lang_tag: U_ILLEGAL_ARGUMENT_ERROR" ```

« previous php.git-pulls (#36420) next »