I have some code in a PHP application that is returning null when I try and use it on the production server, but it works fine on the development server. Here is the line of code:
// use the regex unicode support to separate the UTF-8 characters into an array
preg_match_all( '/./us', $str, $match );
What is the u
flag dependent on? I tested with mb_string
enabled and disabled and it does not seem to affect it.
The error I'm getting is
preg_match_all: Compilation failed: unknown option bit(s) set at offset -1
more info
this is one of the options on the prodction server:
'--with-pcre-regex=/opt/pcre'
and here are the pcre sections
I believe this is the note @Wesley was referring to:
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.
Any links or tips on how to "build PCRE to include UTF-8" ?
results of 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