Ho un codice in un'applicazione PHP che restituisce null quando provo a utilizzarlo sul server di produzione, ma funziona correttamente sul server di sviluppo. Ecco la riga di codice:Da cosa dipende l'indicatore preg_match_all `u`?
// use the regex unicode support to separate the UTF-8 characters into an array
preg_match_all('/./us', $str, $match);
Qual è la bandiera u
dipende? Ho provato con mb_string
attivato e disattivato e non sembra influenzarlo.
L'errore che sto ottenendo è
preg_match_all: Compilation failed: unknown option bit(s) set at offset -1
maggiori informazioni
questa è una delle opzioni sul server prodction:
'--with-pcre-regex=/opt/pcre'
e qui sono le sezioni di pc
Picture.png http://img829.imageshack.us/img829/8524/pictureke.png
Credo che questo sia il @Wesley nota si riferiva 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.
Eventuali link o suggerimenti su come "costruire PCRE per includere UTF-8"?
risultati 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
Stai testando una variabile o un valore costante? Il tuo esempio ha una variabile, penso che dovresti testare una costante per assicurarti di fare lo stesso su dev e live. – hakre
http://php.net/manual/en/reference.pcre.pattern.modifiers.php, guarda anche i commenti. –