ID: 14304 Updated by: zak Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Strings related Operating System: Linux php3-2 2.4.7 #1 Thu Aug 9 PHP Version: 4.0.6 New Comment:
Please reduce this to a simpler test case. If there is a bug in str_replace, then it should be reproduceable with a simple one line test. Logging how the str_replace functions are called should let you find the culprit. A line like this after the function calls are made should do the trick. error_log ("$line = str_replace({$regs[0]},$replacement,$line);\n", 3, './str_rep_log'); Good Luck! Previous Comments: ------------------------------------------------------------------------ [2001-11-30 13:45:17] [EMAIL PROTECTED] Sorry, i forgot : All the application in dowloadable at : http://phpdig.toiletoine.net/phpdig_1_4_3.zip ------------------------------------------------------------------------ [2001-11-30 13:40:34] [EMAIL PROTECTED] Summary : A function works well on php 4.0.5 and enters an infinite loop on php 4.0.6. Function entering in infinite loop : The purpose of this function is to parse a template containing some tags, line by line, and replace them by values contained in the $t_strings array. The input can be : <td bgcolor="#FFCC00" colspan="2"><phpdig:previous_link src='./tpl_img/left.gif'/><phpdig:pages_bar/><phpdig:next_link src='./tpl_img/right.gif'/></td> i think the str_replace() function don't replace anything ; the while statment stays always true, etc... function parse_phpdig_tags($line,$t_strings) { while(eregi('<phpdig:([a-z0-9_]*)[[:blank:]]*(src=)*["\']*([a-z0-9./_-]+)*["\']*[[:blank:]]*/>',$line,$regs)) { //links with images if ($regs[2]) { if ($regs[3] && $t_strings[$regs[1]]) { if (ereg('^http',$t_strings[$regs[1]])) $target = ' target="_blank"'; else $target = ''; $replacement = '<A href="'.$t_strings[$regs[1]].'"'.$target.'><img src="'.$regs[3].'" border="0" align="bottom"></a>'; } else { $replacement = ''; } $line = str_replace($regs[0],$replacement,$line); } else { $line = str_replace($regs[0],$t_strings[$regs[1]],$line); } } return $line; } Configuration not working (php 4.0.6) : '../configure' '--prefix=/usr' '--prefix=/usr' '--with-regex=system' '--enable-force-cgi-redirect' '--with-config-file-path=/etc/php4/cgi' '--disable-rpath' '--disable-pear' '--enable-memory-limit' '--enable-calendar' '--enable-bcmath' '--with-bz2' '--enable-ctype' '--with-db2' '--with-ndbm' '--enable-exif' '--enable-filepro' '--with-gettext' '--enable-track-vars' '--enable-trans-sid' '--disable-debug' '--disable-static' '--with-mm' '--with-pcre-regex=/usr' '--enable-shmop' '--enable-sockets' '--with-xml=/usr' '--with-expat-dir=/usr' '--with-zlib' '--enable-email' '--disable-posix' '--without-mysql' '--without-sybase-ct' Configuration working (php 4.0.5) : './configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-pgsql=/usr/local/pgsql' '--with-ldap' '--with-openssl' '--with-domxml' '--with-bcmath' '--enable-track-vars' '--with-gd=../gd-1.8.4' '--enable-freetype-4bit-antialias-hack' '--with-mysql' '--with-jpeg-dir=../jpeg-6b' '--with-png-dir=../libpng-1.0.12' '--with-freetype-dir=../freetype-2.0.4' '--with-zlib-dir=../zlib' '--with-sablot=SHARED' '--enable-bcmath' '--enable-ftp' '--enable-sockets' '--enable-magic-quotes' '--enable-versioning' ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=14304&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]