#24454 [Csd]: Problems with preg_match() in while(!feof()) loop
| From: | sniper@php.net | Date: | Wed, 02 Jul 2003 13:11:34 +0000 |
| Subject: | #24454 [Csd]: Problems with preg_match() in while(!feof()) loop | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-43079@lists.php.net to get a copy of this message | ||
ID: 24454
Updated by: sniper@php.net
Reported By: mattias at segerdahl dot info
Status: Closed
Bug Type: PCRE related
Operating System: Mandrake 9.1
PHP Version: 5.0.0b1 (beta1)
New Comment:
..and I should learn to read. :)
Previous Comments:
------------------------------------------------------------------------
[2003-07-02 08:11:00] sniper@php.net
1. Wrong category
2. Bad, very bad example script (uses external
resource,dirlist.template.php, which we do not have)
3. Already fixed in CVS.
------------------------------------------------------------------------
[2003-07-02 01:57:14] mattias at segerdahl dot info
Expected results and actual results should be switched.
------------------------------------------------------------------------
[2003-07-02 01:48:56] mattias at segerdahl dot info
Expected results and actual results should be switched.
------------------------------------------------------------------------
[2003-07-02 01:48:04] mattias at segerdahl dot info
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 this bug report at http://bugs.php.net/?id=24454&edit=1