[PHP-DEV] Re: PHP 4.0 Bug #9373 Updated: Filesystem read not binary safe?

2001-02-23 Thread Auke van Slooten

On 22 Feb 2001, Bug Database wrote:

 ID: 9373
 Updated by: sniper
 Reported By: [EMAIL PROTECTED]
 Old-Status: Open
 Status: Closed
 Bug Type: Filesystem function related
 Assigned To:
 Comments:

 This should be fixed in CVS already. Please try a dev build from
 http://www.php4win.de/

 --Jani

Hi,
  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

(btw: the first version of the code runs fine with either the cgi or the
unix apache module version).

regards,
Auke van Slooten
http://www.muze.nl/


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Re: PHP 4.0 Bug #9373 Updated: Filesystem read notbinary safe?

2001-02-23 Thread Auke van Slooten

On Fri, 23 Feb 2001, Hartmut Holzgraefe wrote:

 did you add 'b' to the fopen() mode to enforce binary operation?

 i.e. $fp=fopen($filename,"rb") instead of plain "b"?

No we didn't, and yes, if you do, everything works fine :)
Thanks for the heads up. Still, it took me some time to find it in the
manual even after your email... maybe it's a good idea to simply add it in
the list with 'a','r', 'w' and the rest? Also, it says in bright and shiny
letters in the manual 'fread -- Binary-safe file read'... somehow I didn't
expect that that means I still need to tell fopen about it too :))

thanks for the good work, php4.05.dev runs very stable on our systems now,
and it's blazing fast :)

regards,
Auke van Slooten
Muze



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]