Re: cvs: php4 /ext/standard file.c /main php_streams.h streams.c

From: Date: Fri, 18 Oct 2002 21:50:34 +0000
Subject: Re: cvs: php4 /ext/standard file.c /main php_streams.h streams.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-15034@lists.php.net to get a copy of this message
> > 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

« previous php.cvs (#15034) next »