mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
+ document feof() pitfall if invalid handle passed
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@196438 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
298c98367f
commit
45b1f93b7a
1 changed files with 21 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.feof">
|
||||
<refnamediv>
|
||||
|
@ -26,6 +26,26 @@
|
|||
</simpara>
|
||||
</warning>
|
||||
&fs.validfp.all;
|
||||
<warning>
|
||||
If passed file pointer is not valid you may get an infinite loop, because
|
||||
EOF fails to return TRUE.
|
||||
<example>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// if file can not be read or doesn't exist fopen function returns FALSE
|
||||
$file = @fopen("no_such_file", "r");
|
||||
|
||||
// FALSE from fopen will issue warning and result in infinite loop here
|
||||
while (!feof($file)) {
|
||||
}
|
||||
|
||||
fclose($file);
|
||||
?>
|
||||
?]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</warning>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
Loading…
Reference in a new issue