Re: Re: PHP 4.0 Bug #9373 Updated: Filesystem read not binary safe?

From: Date: Fri, 23 Feb 2001 15:11:00 +0000
Subject: Re: Re: PHP 4.0 Bug #9373 Updated: Filesystem read not binary safe?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-47342@lists.php.net to get a copy of this message
Auke van Slooten wrote: > we've tried the dev build (4.05.dev) and it seems to work, thanks! > however (there's always an however:) we've still got a problem. In the > distribution of Ariadne we've included a serialized array in a separate > file. When reading this file using the following code: > > $data=fread($fp,$fs); > $mod->data=unserialize($data); > > unserialize fails halfway through the data. Also the string length of > $data is smaller than the file length. After changing the code to this: > > $data=fread($fp,$fs); > $data=str_replace("\n","\r\n",$data); > $mod->data=unserialize($data); > > unserialize() ran fine... it seems that fread still 'fixes' > return/linefeeds did you add 'b' to the fopen() mode to enforce binary operation? i.e. $fp=fopen($filename,"rb") instead of plain "b"? -- Hartmut Holzgraefe hartmut@six.de http://www.six.de +49-711-99091-77 Besuchen Sie uns auf der CeBIT 2001 - in Halle 6 Stand F62/4

« previous php.dev (#47342) next »