Skip to content

Commit 13f3999

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix #72809: Locale::lookup() wrong result with canonicalize option
2 parents 77bfe96 + 0f1b17e commit 13f3999

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2021, PHP 8.0.9
44

5+
- Intl:
6+
. Fixed bug #72809 (Locale::lookup() wrong result with canonicalize option).
7+
(cmb)
8+
59
17 Jun 2021, PHP 8.0.8
610

711
- Core:

ext/intl/locale/locale_methods.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static zend_off_t getStrrtokenPos(char* str, zend_off_t savedPos)
146146
zend_off_t i;
147147

148148
for(i=savedPos-1; i>=0; i--) {
149-
if(isIDSeparator(*(str+i)) ){
149+
if(isIDSeparator(*(str+i)) || isKeywordSeparator(*(str+i))){
150150
/* delimiter found; check for singleton */
151151
if(i>=2 && isIDSeparator(*(str+i-2)) ){
152152
/* a singleton; so send the position of token before the singleton */

ext/intl/tests/locale/bug72809.phpt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Bug #72809 (Locale::lookup() wrong result with canonicalize option)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('intl')) die("skip intl extension not avaible");
6+
?>
7+
--FILE--
8+
<?php
9+
var_dump(
10+
Locale::lookup(['en', 'en-US'], 'en-US-u-cu-EUR-tz-deber-fw-mon', true),
11+
Locale::lookup(['en', 'en_US'], 'en_US@currency=eur;fw=mon;timezone=Europe/Berlin', false),
12+
Locale::lookup(['en', 'en_US'], 'en_US@currency=eur;fw=mon;timezone=Europe/Berlin', true),
13+
);
14+
?>
15+
--EXPECT--
16+
string(5) "en_us"
17+
string(5) "en_US"
18+
string(5) "en_us"

0 commit comments

Comments
 (0)