|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36914 SplFileObject::fwrite() bug
Submitted: 2006-03-29 16:20 UTC Modified: 2006-03-29 17:25 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: c dot affolter at stepping-stone dot ch Assigned:
Status: Not a bug Package: SPL related
PHP Version: 5CVS-2006-03-29 (CVS) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: c dot affolter at stepping-stone dot ch
New email:
PHP Version: OS:


 [2006-03-29 16:20 UTC] c dot affolter at stepping-stone dot ch
The bug #36359 doesn't seems to be fixed in the latest CVS version:

The string to be written ($str) doesn't gets passed to the fwrite() function.

The method SplFileObject::fwrite() has to be corrected:
    function fwrite($str, $length = NULL)

        // wrong:
        //return fwrite($this->fp, $length);

        // correct:
        return fwrite($this->fp, $str, $length);



Reproduce code:
splFileObject = new FileObject('test.txt', 'w');

Expected result:
cat test.txt

Actual result:
cat test.txt


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-29 17:25 UTC]
Your code is wrong, but this code works perfectly fine:
$splFileObject = new SplFileObject('test.txt', 'w');
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC