php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31576 mbregex fails to recognise word boundary markers [[:<:]]
Submitted: 2005-01-16 20:39 UTC Modified: 2005-02-21 10:38 UTC
From: mw at lanfear dot com Assigned:
Status: Not a bug Package: mbstring related
PHP Version: * OS: irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
40 + 8 = ?
Subscribe to this entry?

 
 [2005-01-16 20:39 UTC] mw at lanfear dot com
Description:
------------
The mbregex compiler appears to have a bug in it via which it cannot compile the word boundary markers [[:<:]] and [[:>:]] on the Windows version of PHP. (IIS5.1, PHP 5.0.3)

On the Unix version of PHP, these boundaries work fine, with or without the mbstring and mbregex extension enabled, and the Windows versions of PHP will also recognise these markers IFF the mbstring.dll is disabled.

Given the string:

$strr "This is an ip address: 192.168.1.1 ..."

The following:

ereg("[[:<:]][0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[[:>:]]", $strr, $regex);

will generate the following error in windows (IIS5.1, PHP 5.0.3), provided mbstring is enabled:


Warning: mb_ereg() [function.mb-ereg]: mbregex compile err: invalid POSIX bracket type in c:\Inetpub\wwwroot\regex_test.php on line 5
NULL

Reproduce code:
---------------
<?php

$ipaddrs = "192.168.12.22, then followed by 192.168.1.1";

ereg("[[:<:]][0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[[:>:]]", $ipaddrs, $regex);

var_dump($regex);

?>


Expected result:
----------------
array(1) { [0]=>  string(13) "192.168.12.22" }

Actual result:
--------------
Warning: mb_ereg() [function.mb-ereg]: mbregex compile err: invalid POSIX bracket type in c:\Inetpub\wwwroot\regex_test.php on line 5
NULL

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-21 10:38 UTC] moriyoshi@php.net
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

[[:<:]] [[:>:]]

These styles of regular expression are not official part 
of POSIX standard.

http://www.opengroup.org/onlinepubs/009695399/basedefs/
xbd_chap09.html

The implementation used in ereg*() is originally 
extended in some way, probably to use with Tcl.

Better use /b and /B instead for more compatibility.

 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Oct 21 15:03:34 2021 UTC