From:             mattias at segerdahl dot info
Operating system: Mandrake 9.1
PHP version:      5.0.0b1 (beta1)
PHP Bug Type:     Unknown/Other Function
Bug description:  Problems with preg_match() in while(!feof()) loop

Description:
------------
When running the following test, php dies on the 2nd loop preg_match()

Reproduce code:
---------------
==[test.php]===========================
<?php
  
  $fp = fopen("dirlist.template.php","r");
  
  while(!feof($fp))
  {
    echo 'start<br>' . "\n";
        echo
preg_replace("/\[!([^\]]+)!\]/e","\$this->tpl[\"\\1\"]",fgets($fp,1024));
    echo 'there<br>' . "\n";
  }
  
  fclose($fp);

  show_source("test2.php");
  show_source("dirlist.template.php");
?>
=======================================

==[dirlist.template.php]===============
<tr>
  <td width="20"><img src="templates/images/ico_[!FILETYPE!].gif"
width="16" height="16" alt="" border="0"></td>
  <td align="left"><a href="[!FILEURL!]">[!FILENAME!]</a></td>
  <td align="right">[!VERSIONS!]</td>
  <td align="right">[!DATETIME!]</td>
</tr>
=======================================


Expected result:
----------------
start
end
start

Actual result:
--------------
start
end
start
end
start
end
start
end
start
end
start
end

-- 
Edit bug report at http://bugs.php.net/?id=24454&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=24454&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=24454&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24454&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24454&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24454&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24454&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24454&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24454&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24454&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24454&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24454&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24454&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24454&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24454&r=gnused

Reply via email to