|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: ysu at ysumail dot com
New email:
PHP Version: OS:


 [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: Thu Jul 07 02:05:43 2022 UTC