php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46779 Compilation failed in preg_replace for Unicode character properties
Submitted: 2008-12-06 11:24 UTC Modified: 2008-12-10 09:41 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: dytrych at webovy-servis dot cz Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.2.7 OS: Debian GNU/Linux 2.6.23.17
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dytrych at webovy-servis dot cz
New email:
PHP Version: OS:

 

 [2008-12-06 11:24 UTC] dytrych at webovy-servis dot cz
Description:
------------
Unicode character properties doesn't work in preg_replace (since PHP 5.2.7).

PCRE (Perl Compatible Regular Expressions) Support 	enabled
PCRE Library Version: 7.8 2008-09-05 


Results with phpinfo: http://seo-servis.cz/testpl.php

Reproduce code:
---------------
echo preg_replace("~[^\\pL]+~u", '-', "a 3");

echo preg_replace('~[^\\p{L}]+~u', '-', "a 3");

Expected result:
----------------
a-3
a-3

Actual result:
--------------
Warning: preg_replace() [function.preg-replace]: Compilation failed: unknown property name after \P or \p at offset 4 in xxx on line 3

Warning: preg_replace() [function.preg-replace]: Compilation failed: unknown property name after \P or \p at offset 6 in xxx on line 4

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-08 22:04 UTC] nlopess@php.net
I can't reproduce this problem.
My guess is that you are linking against your system's PCRE library (which can be confirmed by checking if pcre appears in output of "ldd `which php`") instead of using the bundled version. If that is the case, then your library was compiled without unicode support.
 [2008-12-10 09:41 UTC] nlopess@php.net
btw, this might be related with http://bugs.php.net/46800
 [2014-07-12 21:03 UTC] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&revision=334259
Log: typofix (Patch by anonymous #46779)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 14:01:34 2025 UTC