mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.0'
* PHP-8.0: Fix locale switch back to C in pcre
This commit is contained in:
commit
3b88e65265
2 changed files with 19 additions and 1 deletions
|
@ -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);
|
||||||
|
|
18
ext/pcre/tests/ctype_back_to_c.phpt
Normal file
18
ext/pcre/tests/ctype_back_to_c.phpt
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue