xref: /PHP-8.3/ext/pcre/tests/locales.phpt (revision 60189aa9)
1--TEST--
2Localized match
3--SKIPIF--
4<?php
5if (setlocale(LC_ALL, 'invalid') === 'invalid') { die('skip setlocale() is broken /w musl'); }
6if (!@setlocale(LC_ALL, 'pt_PT', 'pt', 'pt_PT.ISO8859-1', 'portuguese')) die('skip pt locale not available');
7?>
8--FILE--
9<?php
10
11// this tests if the cache is working correctly, as the char tables
12// must be rebuilt after the locale change
13
14setlocale(LC_ALL, 'C', 'POSIX');
15var_dump(preg_match('/^\w{6}$/', 'a�����'));
16
17setlocale(LC_ALL, 'pt_PT', 'pt', 'pt_PT.ISO8859-1', 'portuguese');
18var_dump(preg_match('/^\w{6}$/', 'a�����'));
19
20setlocale(LC_ALL, 'C', 'POSIX');
21var_dump(preg_match('/^\w{6}$/', 'a�����'));
22
23?>
24--EXPECT--
25int(0)
26int(1)
27int(0)
28