php.net |  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
 [2010-11-10 04:53 UTC] ysu at ysumail dot com
Description:
------------
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:
---------------
<?php

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

?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] cataphract@php.net
-Status: Closed +Status: Bogus
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri May 20 16:03:34 2022 UTC