|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53288 "Compilation failed" on certain pcre patterns in preg_replace
Submitted: 2010-11-10 04:53 UTC Modified: 2010-11-10 21:17 UTC
From: ysu at ysumail dot com Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.3.3 OS: win7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
3 + 41 = ?
Subscribe to this entry?

 [2010-11-10 04:53 UTC] ysu at ysumail dot com
Trying the code, it'll give you this warning:

Warning: preg_replace() [function.preg-replace]: Compilation failed: range out of order in character class at offset 6 in D:\www\integraCMS\scripts\testOffset.php on line 4

However, if you shuffle the characters around it'll not happen.

Test script:

$value = "this @ is . a _ test-string";
$value = preg_replace('#[^\w_-.@]#','',$value);
echo $value;



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-10 05:00 UTC] ysu at ysumail dot com
-Status: Open +Status: Closed
 [2010-11-10 05:00 UTC] ysu at ysumail dot com
Um, I think I've overlooked that hyphen, my apologies.
 [2010-11-10 21:17 UTC]
-Status: Closed +Status: Bogus
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Jul 04 04:05:46 2022 UTC