Skip to content

Commit c086333

Browse files
committed
Merge branch 'PHP-7.1'
* PHP-7.1: update NEWS Fixed bug #72658 Locale::lookup() / locale_lookup() hangs if no match found
2 parents f081922 + 0d50502 commit c086333

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

ext/intl/locale/locale_methods.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ static char* getPreferredTag(const char* gf_tag)
145145
* or -1 if no token
146146
* strtokr equivalent search for token in reverse direction
147147
*/
148-
static int getStrrtokenPos(char* str, int savedPos)
148+
static zend_off_t getStrrtokenPos(char* str, zend_off_t savedPos)
149149
{
150-
int result =-1;
151-
int i;
150+
zend_off_t result =-1;
151+
zend_off_t i;
152152

153153
for(i=savedPos-1; i>=0; i--) {
154154
if(isIDSeparator(*(str+i)) ){
@@ -1429,7 +1429,7 @@ static zend_string* lookup_loc_range(const char* loc_range, HashTable* hash_arr,
14291429

14301430
char* cur_loc_range = NULL;
14311431
zend_string* can_loc_range = NULL;
1432-
size_t saved_pos = 0;
1432+
zend_off_t saved_pos = 0;
14331433

14341434
zend_string* return_value = NULL;
14351435

ext/intl/tests/locale_bug72658.phpt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Bug #72658 Locale::lookup() / locale_lookup() hangs if no match found
3+
--SKIPIF--
4+
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5+
--FILE--
6+
<?php
7+
8+
var_dump(
9+
Locale::lookup(['en-Latn-US', 'sl', 'sl-IT'], 'en-US', true, 'de-DE'),
10+
Locale::lookup(['en-Latn-US', 'sl', 'sl-IT'], 'en-US', false, 'de-DE')
11+
);
12+
13+
?>
14+
==DONE==
15+
--EXPECT--
16+
string(5) "de-DE"
17+
string(5) "de-DE"
18+
==DONE==

0 commit comments

Comments
 (0)