diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-18 10:48:43 +0100 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-18 10:48:43 +0100 |
| commit | 4be867e9103a415c598d5a15f95fec274d1b7825 (patch) | |
| tree | 8861ac225063f3535fa11443fea19d5ec5196d73 /ext/pcre/tests | |
| parent | a08847ab39bb512d500cf196981a3e8780c83600 (diff) | |
| download | php-git-4be867e9103a415c598d5a15f95fec274d1b7825.tar.gz | |
Fix locale switch back to C in pcre
The compile context is shared between patterns, so we need to set
the character tables unconditionally in case we switched from
a non-C locale to the C locale.
Diffstat (limited to 'ext/pcre/tests')
| -rw-r--r-- | ext/pcre/tests/ctype_back_to_c.phpt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/pcre/tests/ctype_back_to_c.phpt b/ext/pcre/tests/ctype_back_to_c.phpt new file mode 100644 index 0000000000..b329091671 --- /dev/null +++ b/ext/pcre/tests/ctype_back_to_c.phpt @@ -0,0 +1,18 @@ +--TEST-- +Changing LC_CTYPE back to C +--SKIPIF-- +<?php +if (!setlocale(LC_CTYPE, "de_DE", "de-DE")) die("skip requires de_DE locale"); +?> +--FILE-- +<?php +var_dump(setlocale(LC_CTYPE, "de_DE", "de-DE") !== false); +var_dump(preg_match('/\w/', "\xe4")); +var_dump(setlocale(LC_CTYPE, "C") !== false); +var_dump(preg_match('/\w/', "\xe4")); +?> +--EXPECT-- +bool(true) +int(1) +bool(true) +int(0) |
