Merge branch 'PHP-8.0'

* PHP-8.0:
  Fix locale switch back to C in pcre
This commit is contained in:
Nikita Popov 2021-03-18 10:51:04 +01:00
commit 3b88e65265
2 changed files with 19 additions and 1 deletions

View file

@ -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_hash_add_ptr(&char_tables, _k, (void *)tables);
zend_string_release(_k); 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. */ /* Compile pattern and display a warning if compilation failed. */
re = pcre2_compile((PCRE2_SPTR)pattern, pattern_len, coptions, &errnumber, &erroffset, cctx); re = pcre2_compile((PCRE2_SPTR)pattern, pattern_len, coptions, &errnumber, &erroffset, cctx);

View file

@ -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)