File tree Expand file tree Collapse file tree 3 files changed +68
-0
lines changed Expand file tree Collapse file tree 3 files changed +68
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ FILTER_VALIDATE_DOMAIN FILTER_FLAG_HOSTNAME should not be locale dependent
3
+ --EXTENSIONS--
4
+ filter
5
+ --SKIPIF--
6
+ <?php // try to activate a single-byte german locale
7
+ if (!setlocale (LC_ALL , "de_DE " )) {
8
+ print "skip Can't find german locale " ;
9
+ }
10
+ ?>
11
+ --FILE--
12
+ <?php
13
+ var_dump (filter_var ('٪ ' , FILTER_VALIDATE_DOMAIN , FILTER_FLAG_HOSTNAME ));
14
+ setlocale (LC_ALL , "de_DE " );
15
+ var_dump (filter_var ('٪ ' , FILTER_VALIDATE_DOMAIN , FILTER_FLAG_HOSTNAME ));
16
+ ?>
17
+ --EXPECT--
18
+ bool(false)
19
+ bool(false)
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Stream wrappers should not be locale dependent
3
+ --SKIPIF--
4
+ <?php // try to activate a single-byte german locale
5
+ if (!setlocale (LC_ALL , "de_DE " )) {
6
+ print "skip Can't find german locale " ;
7
+ }
8
+ ?>
9
+ --INI--
10
+ allow_url_fopen=1
11
+ display_errors=stderr
12
+ --FILE--
13
+ <?php
14
+ setlocale (LC_ALL , "de_DE " );
15
+ class testwrapper {
16
+ }
17
+
18
+ var_dump (ctype_alpha ('٪ ' )); // \xd9 and \xaa are both alphabetical in the german locale
19
+ var_dump (stream_wrapper_register ("test٪ " , 'testwrapper ' , STREAM_IS_URL ));
20
+
21
+ echo 'stream_open: ' ;
22
+ fopen ("test٪://test " , 'r ' );
23
+ ?>
24
+ --EXPECTF--
25
+ bool(true)
26
+ Warning: stream_wrapper_register(): Invalid protocol scheme specified. Unable to register wrapper class testwrapper to test٪:// in %s on line 7
27
+ bool(false)
28
+ stream_open: Warning: fopen(test٪://test): Failed to open stream: No such file or directory in %s on line 10
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #52923 (Locale settings affecting parse_url)
3
+ --SKIPIF--
4
+ <?php // try to activate a german locale
5
+ if (!setlocale (LC_ALL , "de_DE " )) {
6
+ print "skip Can't find german locale " ;
7
+ }
8
+ ?>
9
+ --FILE--
10
+ <?php
11
+ echo http_build_query (parse_url ("http \xfc://invalid " ), true ), "\n" ;
12
+ // activate the german locale. With this bug fix, locale settings should no longer affect parse_url
13
+ var_dump (setlocale (LC_CTYPE , "de_DE " ));
14
+ echo http_build_query (parse_url ("http \xfc://invalid " ), true ), "\n" ;
15
+ echo http_build_query (parse_url ('http://mydomain.com/path/道 ' )), "\n" ;
16
+ ?>
17
+ --EXPECT--
18
+ path=http%FC%3A%2F%2Finvalid
19
+ string(5) "de_DE"
20
+ path=http%FC%3A%2F%2Finvalid
21
+ scheme=http&host=mydomain.com&path=%2Fpath%2F%E9%81%93
You can’t perform that action at this time.
0 commit comments