On October 18, 2002 05:50 pm, Rasmus Lerdorf wrote:
> > > My point is that the original data is munged once it goes through the
> > > file() function.  In that sense it is not binary safe as there is no
> > > way to restore the original data.
> >
> > Unless the user actually goes and modifies the data, it is very easy to
> > restore the original file back. The example script below will demonstrate
> > that the output of file() can still be safely restored.
> >
> > <?php
> >         echo md5_file("sapi/cli/php")."\n";
> >         echo md5(implode("", file("sapi/cli/php")))."\n";
> > ?>
> >
> > Both of the md5s are identical, meaning that the file() call itself did
> > nothing that would corrupt the file preventing the the user from
> > restoring file. IMHO that means that the function is binary safe.
>
> But EOL is not always \n and it can be a mix of \r\n \n or \r.  You have
> no way of knowing which eol caused the break for any particular line.  In
> that sense file() is irreversible.

Why would I care about that, the EOL are not stripped by file(), so I do not 
need to know EOLs when assembling the file back. As long as I assemble the 
number of lines equal to the number of lines read, I will get the same file. 

Ilia

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to