ID: 29802 User updated by: wesleygoku at yahoo dot com dot br Reported By: wesleygoku at yahoo dot com dot br Status: Open Bug Type: PCRE related Operating System: Windows 2000 SP4 PHP Version: 4.3.8 New Comment:
To clarify the bug, let's explain it better: I'm using preg_replace to replace some code. If this code is bigger than an unknown lenght, something very weird happens. I'm using while to replace ALL of the occurrences in some string, but the preg_match used to verify if the text still appears just tells the code DOESN'T match, although it does! Now, see the problem: This doesn't work, note that many "<ws..." are still there Source code: http://wstec.net/tmp/php_bug_pcre/code_01.html Results: http://wstec.net/tmp/php_bug_pcre/code_01.php Now, without the first two <wsimg>, id works as it should Source code: http://wstec.net/tmp/php_bug_pcre/code_02.html Results: http://wstec.net/tmp/php_bug_pcre/code_02.php I ask you to take a good look at this bug, because I need a resolution about it to keep working on my script. And also note that it isn't with my code, but with the PHP's funcion preg_match and preg_replace. Previous Comments: ------------------------------------------------------------------------ [2004-08-24 18:08:02] wesleygoku at yahoo dot com dot br This is the problem, if I reduce the code, it works. I've checked the XHTML code and the Regular Expression, but everything is fine. ------------------------------------------------------------------------ [2004-08-24 08:38:50] [EMAIL PROTECTED] Please provide a very short example without endless pieces of HTML/XML code. ------------------------------------------------------------------------ [2004-08-23 20:34:42] wesleygoku at yahoo dot com dot br Description: ------------ I'm trying to use preg_replace to evaluate my own XHTML tags, sending their arguments and contents to another funcion. There are two uses, the simple, without content (like <wstag x="y" />), and the complex, with content (like <wstag x="y">x</wstag>). Each one is parsed by their own function, and to evaluate ALL the complex tags (even the tags inside other tags) I'm using a while condition. The problem is very odd, it happens when I use more than one complex tag, and some simple tag before the complex ones, all of this inside another complex tag (you will understand better reading the code), with few complex lines or without simple tags before them, the results are good, but otherwise, the while condition just doesn't work and the Apache thread takes much more time proccessing the script (I don't know why, as the while code just repeats two times). Look at the URL below for more details and note the first code should work (try removing the second one), but not the second! Reproduce code: --------------- http://wstec.net/tmp/php_bug_pcre.html Expected result: ---------------- <pre>NEO_HTML( "list", "action="/?e=2&d=lay"", " <wsimg src="" /> <wsimg src="" /> NEO_HTML( "item", "id="Diretório anterior"", "NEO_HTML( "col", "width="284" href="" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "<b>Diretório anterior</b>" )NEO_HTML( "col", "href="" target="_blank"", "Diretório" )NEO_HTML( "col", "href="" target="_blank" align="right"", "" )" ) NEO_HTML( "item", "id="css.css"", "NEO_HTML( "col", "width="284" href="/css.css" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "css.css" )NEO_HTML( "col", "href="/css.css" target="_blank"", "Estilo CSS" )NEO_HTML( "col", "href="/css.css" target="_blank" align="right"", "3,23 KB" )" ) NEO_HTML( "item", "id="ico.gif"", "NEO_HTML( "col", "width="284" href="/ico.gif" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "ico.gif" )NEO_HTML( "col", "href="/ico.gif" target="_blank"", "Imagem" )NEO_HTML( "col", "href="/ico.gif" target="_blank" align="right"", "66 Bytes" )" ) NEO_HTML( "item", "id="list_order_asc.gif"", "NEO_HTML( "col", "width="284" href="/list_order_asc.gif" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "list_order_asc.gif" )NEO_HTML( "col", "href="/list_order_asc.gif" target="_blank"", "Imagem" )NEO_HTML( "col", "href="/list_order_asc.gif" target="_blank" align="right"", "61 Bytes" )" ) NEO_HTML( "item", "id="list_order_desc.gif"", "NEO_HTML( "col", "width="284" href="/list_order_desc.gif" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "list_order_desc.gif" )NEO_HTML( "col", "href="/list_order_desc.gif" target="_blank"", "Imagem" )NEO_HTML( "col", "href="/list_order_desc.gif" target="_blank" align="right"", "61 Bytes" )" ) NEO_HTML( "item", "id="top_admin.gif"", "NEO_HTML( "col", "width="284" href="/top_admin.gif" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "top_admin.gif" )NEO_HTML( "col", "href="/top_admin.gif" target="_blank"", "Imagem" )NEO_HTML( "col", "href="/top_admin.gif" target="_blank" align="right"", "1,17 KB" )" ) NEO_HTML( "item", "id="top_bg.gif"", "NEO_HTML( "col", "width="284" href="/top_bg.gif" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "top_bg.gif" )NEO_HTML( "col", "href="/top_bg.gif" target="_blank"", "Imagem" )NEO_HTML( "col", "href="/top_bg.gif" target="_blank" align="right"", "149 Bytes" )" ) NEO_HTML( "item", "id="top_logo.gif"", "NEO_HTML( "col", "width="284" href="/top_logo.gif" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "top_logo.gif" )NEO_HTML( "col", "href="/top_logo.gif" target="_blank"", "Imagem" )NEO_HTML( "col", "href="/top_logo.gif" target="_blank" align="right"", "2,08 KB" )" ) <wsfooter search="" action="move|Mover" action="copy|Copiar" action="remove|Remover|3" /> " )</pre> Actual result: -------------- <pre>NEO_HTML( "list", "action="/?e=2&d=lay"", " <wsimg src="" /> <wsimg src="" /> NEO_HTML( "item", "id="Diretório anterior"", "NEO_HTML( "col", "width="284" href="" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "<b>Diretório anterior</b>" )NEO_HTML( "col", "href="" target="_blank"", "Diretório" )NEO_HTML( "col", "href="" target="_blank" align="right"", "" )" ) NEO_HTML( "item", "id="css.css"", "NEO_HTML( "col", "width="284" href="/css.css" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "css.css" )NEO_HTML( "col", "href="/css.css" target="_blank"", "Estilo CSS" )NEO_HTML( "col", "href="/css.css" target="_blank" align="right"", "3,23 KB" )" ) NEO_HTML( "item", "id="ico.gif"", "NEO_HTML( "col", "width="284" href="/ico.gif" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "ico.gif" )NEO_HTML( "col", "href="/ico.gif" target="_blank"", "Imagem" )NEO_HTML( "col", "href="/ico.gif" target="_blank" align="right"", "66 Bytes" )" ) NEO_HTML( "item", "id="list_order_asc.gif"", "NEO_HTML( "col", "width="284" href="/list_order_asc.gif" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "list_order_asc.gif" )NEO_HTML( "col", "href="/list_order_asc.gif" target="_blank"", "Imagem" )NEO_HTML( "col", "href="/list_order_asc.gif" target="_blank" align="right"", "61 Bytes" )" ) NEO_HTML( "item", "id="list_order_desc.gif"", "NEO_HTML( "col", "width="284" href="/list_order_desc.gif" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "list_order_desc.gif" )NEO_HTML( "col", "href="/list_order_desc.gif" target="_blank"", "Imagem" )NEO_HTML( "col", "href="/list_order_desc.gif" target="_blank" align="right"", "61 Bytes" )" ) NEO_HTML( "item", "id="top_admin.gif"", "NEO_HTML( "col", "width="284" href="/top_admin.gif" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "top_admin.gif" )NEO_HTML( "col", "href="/top_admin.gif" target="_blank"", "Imagem" )NEO_HTML( "col", "href="/top_admin.gif" target="_blank" align="right"", "1,17 KB" )" ) NEO_HTML( "item", "id="top_bg.gif"", "NEO_HTML( "col", "width="284" href="/top_bg.gif" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "top_bg.gif" )NEO_HTML( "col", "href="/top_bg.gif" target="_blank"", "Imagem" )NEO_HTML( "col", "href="/top_bg.gif" target="_blank" align="right"", "149 Bytes" )" ) NEO_HTML( "item", "id="top_logo.gif"", "NEO_HTML( "col", "width="284" href="/top_logo.gif" target="_blank"", " <img width="10" a="1" a="1" a="1" a="1" a="1" a="1" a="1" /> " )NEO_HTML( "col", "width="10"", "top_logo.gif" )NEO_HTML( "col", "href="/top_logo.gif" target="_blank"", "Imagem" )NEO_HTML( "col", "href="/top_logo.gif" target="_blank" align="right"", "2,08 KB" )" ) <wsfooter search="" action="move|Mover" action="copy|Copiar" action="remove|Remover|3" /> " )</pre> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29802&edit=1