#44923 [Opn->WFx]: ereg functions are not unicode aware: provide wrapper functions in PCRE
| From: | jani@php.net | Date: | Mon, 19 Oct 2009 15:01:55 +0000 |
| Subject: | #44923 [Opn->WFx]: ereg functions are not unicode aware: provide wrapper functions in PCRE | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-143685@lists.php.net to get a copy of this message | ||
ID: 44923
Updated by: jani@php.net
Reported By: tokul at users dot sourceforge dot net
-Status: Open
+Status: Wont fix
Bug Type: Regexps related
Operating System: Linux Debian Etch
PHP Version: 6CVS-2008-05-06 (snap)
Previous Comments:
------------------------------------------------------------------------
[2008-08-14 14:42:33] nlopess@php.net
PCRE and ereg_* have different syntaxes. So wrapping ereg to pcre will
break most regexes.
------------------------------------------------------------------------
[2008-08-12 16:38:01] jani@php.net
For unicode aware regexps use PCRE. The old ereg stuff should be
provided as wrapper functions which uses PCRE underneath though.
------------------------------------------------------------------------
[2008-05-06 12:06:03] felipe@php.net
This is expected, the code isn't prepared to works with unicode
strings.
Actually it only use REG_EXTENDED with binary strings, and convert the
unicode string to normal string.
------------------------------------------------------------------------
[2008-05-06 03:59:56] tokul at users dot sourceforge dot net
Description:
------------
expressions that work in older versions fail on PHP6
unicode.semantics=on
Compared 5.2-dev, 5.3-dev and 6.0-dev snapshots
Reproduce code:
---------------
$line = "* 469 EXISTS\r\n";
if (ereg("[^ ]+ +([^ ]+) +EXISTS", $line, $match)) {
var_dump($match[1]);
} else {
var_dump(false);
}
$line = "* 469 FETCH (UID 508 BODY[1]<0> {154}\r\n";
if (ereg('\\{([^\\}]*)\\}', $line, $match)) {
var_dump($match[1]);
} else {
var_dump(false);
}
Expected result:
----------------
string(3) "469"
string(3) "154"
Actual result:
--------------
bool(false)
Warning: ereg(): REG_BADRPT in
/home/tomas/testbeds/test/php60/bin/ereg.php on line 10
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44923&edit=1