PCRE unicode class problem - php preg_match

ctrLogic.net

Registered
Mar 10, 2010
1
0
51
Why am I not able to use something like:
PHP:
preg_match('#([\p{L}]+\s?)+#',$strVar,$matches);
// unicode class for any letter type (accentuated or not): \p{L}
Seems like the compiled php isn't using the good PCRE lib.
Why is that?
  1. a bug?
  2. an extension missing for it to work?
  3. not related to cpanel/whm in any way?
How to fix this?
  1. recompile PHP myself with good PCRE lib?
  2. can't do a thing about it?

I've updated Apache+PHP with easyApache, but still not fixed.

Current:
Apache: 2.2.15
PHP: 5.3.2
PCRE: 8.0
 

thobarn

Well-Known Member
Apr 25, 2008
152
1
68
sanctum sanctorum
Why am I not able to use something like:
PHP:
preg_match('#([\p{L}]+\s?)+#',$strVar,$matches);
// unicode class for any letter type (accentuated or not): \p{L}
Seems like the compiled php isn't using the good PCRE lib.
Why is that?
  1. a bug?
  2. an extension missing for it to work?
  3. not related to cpanel/whm in any way?
How to fix this?
  1. recompile PHP myself with good PCRE lib?
  2. can't do a thing about it?

I've updated Apache+PHP with easyApache, but still not fixed.

Current:
Apache: 2.2.15
PHP: 5.3.2
PCRE: 8.0
Look at the phpinfo "Configure command" section
Code:
--with-pcre-regex=/opt/pcre
. If you do a
Code:
/opt/pcre/bin/pcretest -C
you will see that the utf8 support is not enabled. The latest EasyApache seems to do that. Expect many
Code:
warning: preg_...() [function.preg-...]: Compilation failed: this version of PCRE is not compiled with PCRE_UTF8 support...
warnings in Apache logs every time you use something like \p{L} or /u (lots with 3rd party forum/blog software)

The latest build source should be in /home/cpeasyapache/src/pcre-8.02 if you wish to reconfigure but manual intervention after every run is not ideal so lets hope there will be an easyapache update soon.
 

Defected

Member
Dec 14, 2009
17
0
51
I had the same problem after updating to Easyapache 5086 last night. Fortunately there was a fix a couple of hours later and know everything works fine.
 

constantine

Well-Known Member
Apr 15, 2008
45
0
56
I have the same problem :

Code:
$  /opt/pcre/bin/pcretest -C
PCRE version 8.02 2010-03-19
Compiled with
  No UTF-8 support
  No Unicode properties support
  Newline sequence is LF
  \R matches all Unicode newlines
  Internal link size = 2
  POSIX malloc threshold = 10
  Default match limit = 10000000
  Default recursion depth limit = 10000000
  Match recursion uses stack
But already old version installed :
Code:
[~]# 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
How can I use it in php ?
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
79
458
cPanel Access Level
Root Administrator
How do you fix the issue ?
You have rebuild your EasyApache profile. If you haven't modified the profile since the last build, then the following command will do what you need:

Code:
# /scripts/easyapache --build
 

greengiant

Well-Known Member
Aug 31, 2003
48
0
156
PCRE UTF8 Support

Hi,

The PCRE build is missing the –enable-unicode-properties flag, which is causing "preg_replace_callback() [function.preg-replace-callback]: Compilation failed: this version of PCRE is not compiled with PCRE_UTF8 support" errors still still be displayed even after EasyApache 5090
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
79
458
cPanel Access Level
Root Administrator
Hi,

The PCRE build is missing the –enable-unicode-properties flag, which is causing "preg_replace_callback() [function.preg-replace-callback]: Compilation failed: this version of PCRE is not compiled with PCRE_UTF8 support" errors still still be displayed even after EasyApache 5090
Thank you for that. I've reported the matter to an EasyApache dev so he can address it. Apparently the PHP group does not document how they configure PCRE when built internally, so there may be a few more such errors before it gets straightened out.