From 87a237342282fe036bb90486fdd6cdc392e16ac7 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 3 Oct 2010 16:01:38 +0000 Subject: [PATCH] - Fixed bug #52971 (PCRE-Meta-Characters not working with utf-8) # In PCRE, by default, \d, \D, \s, \S, \w, and \W recognize only ASCII # characters, even in UTF-8 mode. However, this can be changed by setting # the PCRE_UCP option. --- ext/pcre/php_pcre.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index dcbc98fb85..ccb0a51c0e 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -350,7 +350,14 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le case 'S': do_study = 1; break; case 'U': coptions |= PCRE_UNGREEDY; break; case 'X': coptions |= PCRE_EXTRA; break; - case 'u': coptions |= PCRE_UTF8; break; + case 'u': coptions |= PCRE_UTF8; + /* In PCRE, by default, \d, \D, \s, \S, \w, and \W recognize only ASCII + characters, even in UTF-8 mode. However, this can be changed by setting + the PCRE_UCP option. */ +#ifdef PCRE_UCP + coptions |= PCRE_UCP; +#endif + break; /* Custom preg options */ case 'e': poptions |= PREG_REPLACE_EVAL; break; -- 2.40.0