#36914 [NEW]: SplFileObject::fwrite() bug
| From: | c dot affolter at stepping-stone dot ch | Date: | Wed, 29 Mar 2006 14:20:37 +0000 |
| Subject: | #36914 [NEW]: SplFileObject::fwrite() bug | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-95080@lists.php.net to get a copy of this message | ||
From: c dot affolter at stepping-stone dot ch
Operating system: Linux
PHP version: 5CVS-2006-03-29 (CVS)
PHP Bug Type: SPL related
Bug description: SplFileObject::fwrite() bug
Description:
------------
The bug #36359 doesn't seems to be fixed in the latest CVS version:
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/internal/splfileobject.inc?view=markup&rev=1.3&pathrev=HEAD
The string to be written ($str) doesn't gets passed to the fwrite()
function.
The method SplFileObject::fwrite() has to be corrected:
<?php
...
function fwrite($str, $length = NULL)
{
// wrong:
//return fwrite($this->fp, $length);
// correct:
return fwrite($this->fp, $str, $length);
}
...
?>
Thanks!
Reproduce code:
---------------
<?php
splFileObject = new FileObject('test.txt', 'w');
splFileObject->fwrite('test');
?>
Expected result:
----------------
cat test.txt
test
Actual result:
--------------
cat test.txt
[empty]
--
Edit bug report at http://bugs.php.net/?id=36914&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36914&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36914&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36914&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36914&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36914&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36914&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36914&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36914&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36914&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36914&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36914&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36914&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36914&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36914&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36914&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36914&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36914&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36914&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36914&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36914&r=mysqlcfg