On Sat, 2002-02-09 at 17:00, Andrew L. wrote: > I'm running PHP/4.1.1 and I get warning messages if I don't include the > second param. Am I missing something? I don't know, but I don't get the error:
<?php error_reporting(E_ALL); $fp = fopen('/etc/passwd', 'r'); while (!feof($fp)) { echo fgets($fp); } fclose($fp); ?> ...and in CVS we find: http://cvs.php.net/diff.php/php4/ext/standard/file.c?r1=1.195&r2=1.196&ty=h And it's still there in 4.2.0-dev: http://cvs.php.net/co.php/php4/ext/standard/file.c?r=1.204 I don't know why you're getting errors. Torben > On Saturday 09 February 2002 06:38 pm, Torben Wilson wrote: > > torben Sat Feb 9 19:38:40 2002 EDT > > > > Modified files: > > /phpdoc/en/functions filesystem.xml > > Log: > > Reverting this; the second parameter is indeed optional in versions > > newer than 4.1.0 (also added a note to this effect). > > > > > > Index: phpdoc/en/functions/filesystem.xml > > diff -u phpdoc/en/functions/filesystem.xml:1.119 > > phpdoc/en/functions/filesystem.xml:1.120 --- > > phpdoc/en/functions/filesystem.xml:1.119 Sat Feb 9 19:18:53 2002 +++ > > phpdoc/en/functions/filesystem.xml Sat Feb 9 19:38:40 2002 > > @@ -1,5 +1,5 @@ > > <?xml version="1.0" encoding="iso-8859-1"?> > > -<!-- $Revision: 1.119 $ --> > > +<!-- $Revision: 1.120 $ --> > > <reference id="ref.filesystem"> > > <title>Filesystem functions</title> > > <titleabbrev>Filesystem</titleabbrev> > > @@ -556,7 +556,7 @@ > > <methodsynopsis> > > <type>string</type><methodname>fgets</methodname> > > <methodparam><type>int</type><parameter>fp</parameter></methodparam> > > - > > <methodparam><type>int</type><parameter>length</parameter></methodparam> + > > <methodparam > > choice="opt"><type>int</type><parameter>length</parameter></methodparam> > > </methodsynopsis> > > <para> > > Returns a string of up to length - 1 bytes read from the file > > @@ -572,8 +572,8 @@ > > Common Pitfalls: > > </para> > > <simpara> > > - People used to the 'C' semantics of fgets should note the > > - difference in how EOF is returned. > > + People used to the 'C' semantics of <function>fgets</function> > > + should note the difference in how <literal>EOF</literal> is returned. > > </simpara> > > <simpara> > > The file pointer must be valid, and must point to a file > > @@ -581,6 +581,12 @@ > > <function>popen</function>, or > > <function>fsockopen</function>. > > </simpara> > > + <note> > > + <para> > > + The <parameter>length</parameter> parameter is only optional in > > + PHP 4.1.0 and newer versions. > > + </para> > > + </note> > > <para> > > A simple example follows: > > <example> > -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506