From:             wberg at doce dot ufl dot edu
Operating system: Linux 2.4.21-alpha-r4
PHP version:      4.3.9
PHP Bug Type:     PCRE related
Bug description:  Preg_Match ignoring word boundaries

Description:
------------
I run PHP 4.3.4 locally on Win XP Pro / ISS 5. The code supplied works
flawlessly.

On the Linux server, however, which currently runs PHP 4.3.9, it seems to
ignore or mess up the \b word boundaries. The same thing happened when the
server ran PHP 4.3.3RC1. Upgrading to 4.3.9 didn't help.

You can see the code in action, where it produces the wrong results, on
the Linux server at:

http://www.kuruvinda.com/test.php

You can get full PHP info() on this server at:

http://www.kuruvinda.com/c.php


Reproduce code:
---------------
<?php
$Pattern = "\b[aàáâäå]rm[eèéêë]\b";

$Blazon = "D'argent, au lion d'azur, armé et lampassé de gueules, (le lion
est quelquefois chargé d'une fleur-de-lis d'or, ou d'un écusson d'or à
l'aigle éployée de sable).";

print "Pattern: $Pattern<p>Blazon: $Blazon<p>";

# Should return "Found"
if (preg_match("/".$Pattern."/i",$Blazon)) {
    print "Found";
} else {
    print "Not Found";
}

$Blazon = "D'argent, au lion d'azur, armée et lampassé de gueules, (le
lion est quelquefois chargé d'une fleur-de-lis d'or, ou d'un écusson d'or
à l'aigle éployée de sable).";

print "<p>Pattern: $Pattern<p>Blazon 2: $Blazon<p>";

# Should return "Not Found"
if (preg_match("/".$Pattern."/i",$Blazon)) {
    print "Found";
} else {
    print "Not Found";
}
?>


Expected result:
----------------
The match should find "armé" as a whole word only in $Blazon and not in
$Blazon2.

Actual result:
--------------
The match does not find "armé" as a whole word in $Blazon, but does find
it in $Blazon2, although it isn't a whole word there.

-- 
Edit bug report at http://bugs.php.net/?id=30435&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30435&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30435&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30435&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30435&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30435&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30435&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30435&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30435&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30435&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30435&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30435&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30435&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30435&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30435&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30435&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30435&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30435&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30435&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30435&r=mysqlcfg

Reply via email to