]> granicus.if.org Git - php/commitdiff
- Fixed bug #52971 (PCRE-Meta-Characters not working with utf-8)
authorFelipe Pena <felipe@php.net>
Sun, 3 Oct 2010 16:01:38 +0000 (16:01 +0000)
committerFelipe Pena <felipe@php.net>
Sun, 3 Oct 2010 16:01:38 +0000 (16:01 +0000)
#   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

index dcbc98fb8516af94e3101e49a6960f08b511e8e0..ccb0a51c0ec840e9767c1e3c5f3eab4f38c535df 100644 (file)
@@ -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;