File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ PHP NEWS
42
42
- Standard:
43
43
. Fixed bug #77135 (Extract with EXTR_SKIP should skip $this).
44
44
(Craig Duncan, Dmitry)
45
+ . Fixed bug ##77937 (preg_match failed). (cmb, Anatol)
45
46
46
47
- Zip:
47
48
. Fixed bug #76345 (zip.h not found). (Michael Maroszek)
Original file line number Diff line number Diff line change @@ -4852,7 +4852,28 @@ PHP_FUNCTION(setlocale)
4852
4852
}
4853
4853
}
4854
4854
4855
+ # ifndef PHP_WIN32
4855
4856
retval = php_my_setlocale (cat , loc ? ZSTR_VAL (loc ) : NULL );
4857
+ # else
4858
+ if (loc ) {
4859
+ /* BC: don't try /^[a-z]{2}_[A-Z]{2}($|\..*)/ except for /^u[ks]_U[KS]$/ */
4860
+ char * locp = ZSTR_VAL (loc );
4861
+ if (ZSTR_LEN (loc ) >= 5 && locp [2 ] == '_'
4862
+ && locp [0 ] >= 'a' && locp [0 ] <= 'z' && locp [1 ] >= 'a' && locp [1 ] <= 'z'
4863
+ && locp [3 ] >= 'A' && locp [3 ] <= 'Z' && locp [4 ] >= 'A' && locp [4 ] <= 'Z'
4864
+ && (locp [5 ] == '\0' || locp [5 ] == '.' )
4865
+ && !(locp [0 ] == 'u' && (locp [1 ] == 'k' || locp [1 ] == 's' )
4866
+ && locp [3 ] == 'U' && (locp [4 ] == 'K' || locp [4 ] == 'S' )
4867
+ && locp [5 ] == '\0' )
4868
+ ) {
4869
+ retval = NULL ;
4870
+ } else {
4871
+ retval = php_my_setlocale (cat , ZSTR_VAL (loc ));
4872
+ }
4873
+ } else {
4874
+ retval = php_my_setlocale (cat , NULL );
4875
+ }
4876
+ # endif
4856
4877
zend_update_current_locale ();
4857
4878
if (retval ) {
4858
4879
if (loc ) {
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Unix locale names are rejected on Windows, except for some special cases
3
+ --SKIPIF--
4
+ <?php
5
+ if (substr (PHP_OS , 0 , 3 ) != 'WIN ' ) die ('skip this test is for Windows platforms only ' );
6
+ ?>
7
+ --FILE--
8
+ <?php
9
+ var_dump (setlocale (LC_ALL , 'de_DE ' ));
10
+ var_dump (setlocale (LC_ALL , 'de_DE.UTF-8 ' ));
11
+ // the following are supposed to be accepted
12
+ var_dump (setlocale (LC_ALL , 'uk_UK ' ));
13
+ var_dump (setlocale (LC_ALL , 'uk_US ' ));
14
+ var_dump (setlocale (LC_ALL , 'us_UK ' ));
15
+ var_dump (setlocale (LC_ALL , 'us_US ' ));
16
+ ?>
17
+ ===DONE===
18
+ --EXPECT--
19
+ bool(false)
20
+ bool(false)
21
+ string(27) "English_United Kingdom.1252"
22
+ string(26) "English_United States.1252"
23
+ string(27) "English_United Kingdom.1252"
24
+ string(26) "English_United States.1252"
25
+ ===DONE===
You can’t perform that action at this time.
0 commit comments