Tengo un código en una aplicación PHP que devuelve nulo cuando intento usarlo en el servidor de producción, pero funciona bien en el servidor de desarrollo. Aquí está la línea de código:¿De qué depende el indicador preg_match_all `u`?
// use the regex unicode support to separate the UTF-8 characters into an array
preg_match_all('/./us', $str, $match);
¿Cuál es la bandera u
dependiente? Probé con mb_string
habilitado y deshabilitado y no parece afectarlo.
El error que estoy recibiendo es
preg_match_all: Compilation failed: unknown option bit(s) set at offset -1
más información
esta es una de las opciones en el servidor prodction:
'--with-pcre-regex=/opt/pcre'
y aquí son las secciones de pcre
Picture.png http://img829.imageshack.us/img829/8524/pictureke.png
Creo que esta es la @Wesley nota se refería a:
In order process UTF-8 strings, you must build PCRE to include UTF-8
support in the code, and, in addition, you must call pcre_compile()
with the PCRE_UTF8 option flag, or the pattern must start with the
sequence (*UTF8). When either of these is the case, both the pattern
and any subject strings that are matched against it are treated as
UTF-8 strings instead of strings of 1-byte characters.
Cualquier enlace o consejos sobre cómo "construir para incluir PCRE UTF-8"?
resultados de pcretest -C
PCRE version 6.6 06-Feb-2006
Compiled with
UTF-8 support
Unicode properties support
Newline character is LF
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack
¿Está probando contra una variable o un valor constante? Tu ejemplo tiene una variable, creo que deberías probar con una constante para asegurarte de que haces lo mismo en dev y en vivo. – hakre
http://php.net/manual/en/reference.pcre.pattern.modifiers.php, vea los comentarios también. –