php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13626 fwrite writes more data to file than in output string
Submitted: 2001-10-10 05:47 UTC Modified: 2002-07-11 02:29 UTC
From: jayp at clear dot net dot nz Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.0.6 OS: W2K
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
50 - 13 = ?
Subscribe to this entry?

 
 [2001-10-10 05:47 UTC] jayp at clear dot net dot nz
I have a SQL DB with GIF data field. f.ex there are 2*27006 bytes in there (hex strings). I can retrieve them without any problems but when I do

  $fp = fopen($fn, 'wb');
  $Bin = ConvertToBinary($GIFString);
  $BlockLength=strlen($Bin);
  set_file_buffer($fp, 0);
  fwrite($fp,$Bin);  
  fclose($fp);

$GIFString has the correct size of 2*27006,
$Bin has the correct binary size of 27006.

But the file has the size of 27176 bytes. I have no idea where the addiotnal 170 bytes are coming from (doesn't help when add the $BlockLength to fwrite). After 0x363 there is a 1 byte shift etc...

regards
Jay

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-10 06:01 UTC] jayp at clear dot net dot nz
I look through the other bug reports and it is the same issues with 0A gets changed to 0D 0A
 [2001-10-10 08:22 UTC] sander@php.net
Reclassified.
 [2002-07-11 02:29 UTC] sniper@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 21:01:29 2024 UTC