Date: 05/04/01
- Next message: ahill <email protected>: "[PHP-DEV] Bug #9571 Updated: Undefined symbols in apache build using PHP 4.0.4pl1"
- Previous message: ahill <email protected>: "[PHP-DEV] Bug #10369 Updated: Openlink4/ODBC odbc_field_type returns nothing"
- Next in thread: andrei <email protected>: "[PHP-DEV] Bug #10668 Updated: preg_replace backquote failure"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 10668
Updated by: andrei
Reported By: smoonen <email protected>
Status: Analyzed
Bug Type: PCRE related
PHP Version: 4.0.5
Assigned To:
Comments:
Oops, \\1 instead of \1.
Previous Comments:
---------------------------------------------------------------------------
[2001-05-04 15:17:15] andrei <email protected>
Ok, I made a little mistake, use "f('\\1')" rather than "f('1')".
---------------------------------------------------------------------------
[2001-05-04 13:59:27] smoonen <email protected>
Oddly, I get the following error:
Warning: Unexpected character in input: '' (ASCII=92) state=1 in /home/groups/t/ta/tavi/htdocs/playground/test.php(4) : regexp code on line 1
Parse error: parse error in /home/groups/t/ta/tavi/htdocs/playground/test.php(4) : regexp code on line 1
Fatal error: Failed evaluating code: f(''\\''') in /home/groups/t/ta/tavi/htdocs/playground/test.php on line 4
PHP compile options may be seen at:
http://tavi.sourceforge.net/playground/phpinfo.php
---------------------------------------------------------------------------
[2001-05-04 12:58:12] andrei <email protected>
Can you explain why you think it fails? The following sample (slightly modified from yours to dump the $s parameter to function):
$str = "abc'\\''def";
function f($s) { var_dump($s); return "x"; }
print preg_replace("/c(.*)d/e", "f('\1')", $str);
outputs:
string(5) "'\''"
abxef
As it should.
---------------------------------------------------------------------------
[2001-05-04 11:44:19] smoonen <email protected>
The following code succeeds on PHP 4.03 and PHP 4.04pl1, but fails on PHP 4.05:
$str = "abc'\\''def";
function f($s) { return "x"; }
print preg_replace("/c(.*)d/e", "f('\1')", $str, -1);
This seems to expose *two* underlying bugs:
1) There appears to be some problem in the regex state
machine
2) There is a definite problem with the replacement of
the backreference with its corresponding string.
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10668&edit=2
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: ahill <email protected>: "[PHP-DEV] Bug #9571 Updated: Undefined symbols in apache build using PHP 4.0.4pl1"
- Previous message: ahill <email protected>: "[PHP-DEV] Bug #10369 Updated: Openlink4/ODBC odbc_field_type returns nothing"
- Next in thread: andrei <email protected>: "[PHP-DEV] Bug #10668 Updated: preg_replace backquote failure"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

