diff options
-rw-r--r-- | ext/pcre/php_pcre.c | 2 | ||||
-rw-r--r-- | ext/pcre/tests/ctype_back_to_c.phpt | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 60d0670213..f4f99432fd 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -790,8 +790,8 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in zend_hash_add_ptr(&char_tables, _k, (void *)tables); zend_string_release(_k); } - pcre2_set_character_tables(cctx, tables); } + pcre2_set_character_tables(cctx, tables); /* Compile pattern and display a warning if compilation failed. */ re = pcre2_compile((PCRE2_SPTR)pattern, pattern_len, coptions, &errnumber, &erroffset, cctx); 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) |