PHP 4.0 Bug #10218: preg_replace() with mod e, refs $10 - $19 don't work
| From: | karen at crazygrrl dot com | Date: | Sat, 07 Apr 2001 00:39:07 +0000 |
| Subject: | PHP 4.0 Bug #10218: preg_replace() with mod e, refs $10 - $19 don't work | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-51079@lists.php.net to get a copy of this message | ||
From: karen@crazygrrl.com
Operating system: FreeBSD 4.2
PHP version: 4.0.4pl1
PHP Bug Type: *Regular Expressions
Bug description: preg_replace() with mod e, refs $10 - $19 don't work
When using preg_replace() with the modifier "e", references
of the form \\3 or $3 don't work correctly for the numbers
10-19, while they do for 0-9 & 20-29. A reference to $15 is
interpreted as a reference to $1 concatenated with the
number 5.
Example:
$numbers = "(one) (two) (3) (4) (5) (6) (7) (8) (9) (10)
(11) (12) (13) (14) (15#5) (16) (17) (18) (19) (20) (21)
(22) (23)";
$pat_without_mod = "/$numbers/";
$pat_with_e_mod = "/$numbers/e";
$text = "one two 3 4 5 6 7 8 9 10 11 12 13 14 15#5 16 17 18
19 20 21 22 23";
echo preg_replace($pat_without_mod, "'\\1 \\15 \\21'",
$text);
// 'one 15#5 21'
echo preg_replace($pat_with_e_mod, "'\\1 \\15 \\21'",
$text);
// one one5 21
echo preg_replace($pat_without_mod, "'$1 $15 $21'", $text);
// 'one 15#5 21'
echo preg_replace($pat_with_e_mod, "'$1 $15 $21'", $text);
// one one5 21
Configure line (via phpinfo() - I'm not the admin):
'./configure' '--with-apache=../apache_1.3.17'
'--with-mysql=/usr/local' '--with-jpeg-dir=../jpeg-6b'
'--with-png' '--with-gd=/usr/local' '--with-ndbm'
'--without-ttf' '--enable-safe-mode' '--enable-dbase'
'--enable-filepro' '--enable-ftp' '--disable-debug'
--
Edit Bug report at: http://bugs.php.net/?id=10218&edit=1