ID:               40961
 User updated by:  jfgingras at cegep-ste-foy dot qc dot ca
 Reported By:      jfgingras at cegep-ste-foy dot qc dot ca
 Status:           Open
 Bug Type:         *Regular Expressions
 Operating System: FreeBSD 6.1-RELEASE
 PHP Version:      5.2.1
 New Comment:

Forget to mention that no php error are logged in the log file. I even
set 666 mode on phperror.log just to be sure that php can write in it.
But still no error shown.

Strangly, like I said preg_replace works if I remove the '/(' and ')/'
from the pattern, but preg_match always return false. But, it print an
error:

[02-Apr-2007 11:51:29] PHP Warning:  preg_match() [<a
href='function.preg-match'>function.preg-match</a>]: No ending delimiter
'^' found in /usr/local/www/f.php on line 6

And here's the line 6:

if(preg_match('^[a-f0-9]{32}$', $body)) echo "YEAH #2!";


Previous Comments:
------------------------------------------------------------------------

[2007-04-02 15:45:18] jfgingras at cegep-ste-foy dot qc dot ca

$body = "b2c3d4e5f6a7b8c9e0f1a2b3c4d5e6f7";
$body = preg_replace('/(^[a-f0-9]{32}$)/', '?', $body );
var_dump($body);

It is not even returning a empty string, it return NULL!

Here's what I have in my php.ini

error_reporting  =  E_ALL
log_errors = On
error_log = /var/log/phperror.log

Here's my php info

[EMAIL PROTECTED] ~]# php -v
PHP 5.2.1 with Suhosin-Patch 0.9.6.2 (cli) (built: Mar 30 2007
10:03:24)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

Any help is more than welcome.

Thx!

------------------------------------------------------------------------

[2007-03-30 22:33:13] tijnema at gmail dot com

$body = "b2c3d4e5f6a7b8c9e0f1a2b3c4d5e6f7";
$body = preg_replace('/(^[a-f0-9]{32}$)/', '?', $body );
var_dump($body);

Above code gives me string(1) "?" on PHP-5.1.6/5.2.1/6.0-dev on linux
using CLI or Apache.

------------------------------------------------------------------------

[2007-03-30 21:06:46] smlerman at gmail dot com

$body = "b2c3d4e5f6a7b8c9e0f1a2b3c4d5e6f7";
$body = preg_replace('/(^[a-f0-9]{32}$)/', '?', $body );
var_dump($body);
string(1) "?"

That's what I get in 5.1.6 on Linux and 5.2.1 on Windows.

------------------------------------------------------------------------

[2007-03-30 17:30:43] jfgingras at cegep-ste-foy dot qc dot ca

Description:
------------
I can't use full PCRE in preg_replace and preg_match functions.

If I do:

$body = "b2c3d4e5f6a7b8c9e0f1a2b3c4d5e6f7";
$body = preg_replace('/(^[a-f0-9]{32}$)/', '?', $body );

preg_replace() return en empty string instead of "?" or the original
string if the regex doesn't match as the documentation says.

But, if I use this:

$body = "b2c3d4e5f6a7b8c9e0f1a2b3c4d5e6f7";
$body = preg_replace('^[a-f0-9]{32}$', '?', $body );

It works!!

I got the same problem with preg_match, it always return false.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40961&edit=1

Reply via email to