#42057 [Opn->Csd]: fwrite() writes data into file when length is given as a negative value
| From: | felipe@php.net | Date: | Mon, 04 Feb 2008 18:47:03 +0000 |
| Subject: | #42057 [Opn->Csd]: fwrite() writes data into file when length is given as a negative value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-121961@lists.php.net to get a copy of this message | ||
ID: 42057
Updated by: felipe@php.net
Reported By: kraghuba at in dot ibm dot com
-Status: Open
+Status: Closed
Bug Type: Filesystem function related
Operating System: RHEL 5
PHP Version: 6CVS-2007-07-21 (CVS)
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2007-07-21 07:33:02] kraghuba at in dot ibm dot com
Description:
------------
fwrite() writes given data to the file when length paramenter is given
as a negative value.
This is only applicable to php6.
Reproduce code:
---------------
<?php
$fp = fopen("test.dat", "w");
$data = "data";
var_dump(fwrite($fp, $data, -10) );
fclose($fp);
var_dump(readfile("test.dat") );
unlink("test.dat");
?>
Expected result:
----------------
int(0)
int(0)
Actual result:
--------------
int(4)
dataint(4)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42057&edit=1