> > 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.

-Rasmus


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

Reply via email to