ID: 40961
Updated by: [EMAIL PROTECTED]
Reported By: jfgingras at cegep-ste-foy dot qc dot ca
-Status: Open
+Status: Feedback
Bug Type: PCRE related
Operating System: FreeBSD 6.1-RELEASE
PHP Version: 5.2.1
New Comment:
Using the latest snapshot and the code below I get "?" as the result.
<?php
$body = "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6";
$body = preg_replace('/^[a-f\d]{32}$/i', '?', $body );
var_dump($body);
?>
Tested on Linux and FreeBSD.
Previous Comments:
------------------------------------------------------------------------
[2007-04-10 14:58:21] jfgingras at cegep-ste-foy dot qc dot ca
Here's what I have about PCRE with phpinfo() :
pcre
PCRE (Perl Compatible Regular Expressions) Support enabled
PCRE Library Version 7.0 18-Dec-2006
Strangly, it's not the first time I have problem with PHP since I
upgrade from 5.1.6 to 5.2.1. See bug #40641.
------------------------------------------------------------------------
[2007-04-10 14:21:58] [EMAIL PROTECTED]
also check if you are using the bundled pcre library or the system's
library. (you can see this in the phpinfo() page).
------------------------------------------------------------------------
[2007-04-10 14:20:08] [EMAIL PROTECTED]
Cannot reproduce both on Linux and FreeBSD.
------------------------------------------------------------------------
[2007-04-03 14:16:38] jfgingras at cegep-ste-foy dot qc dot ca
You're probably right. But still, if I use the following pattern
"/([^\x09\x0A\x0D\x20-\x7E\xA0-\xFF])/", preg_replace always return
NULL. But if I use "[^\x09\x0A\x0D\x20-\x7E\xA0-\xFF]" it "works", that
is, it will not return NULL.
If I use '/^[a-f\d]{32}$/i' on "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6",
preg_match always return false.
The exemples above occur on FreeBSD 6.1 with PHP 5.2.1.
I test thoses on Linux 2.6.9 with PHP 5.1.6 and it work.
Any idea ?
------------------------------------------------------------------------
[2007-04-02 21:27:49] [EMAIL PROTECTED]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php
Your regex is wrong, you cannot include the "$" (end of string) inside
a
capturing sub-pattern.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/40961
--
Edit this bug report at http://bugs.php.net/?id=40961&edit=1