php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51626 Strange fputcsv reaction
Submitted: 2010-04-21 15:45 UTC Modified: 2010-04-21 16:28 UTC
From: marhei at mac dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.3.2 OS: Ubuntu 9.10
Private report: No CVE-ID: None
 [2010-04-21 15:45 UTC] marhei at mac dot com
Description:
------------
$handle = open('test.csv','r+');
fputcsv($handle,$content);

overwrite the last already in the file standing line.

If i write this, the last line is not overwritten:

$handle = open('test.csv','r+');
while($current = fgetcsv(handle)) {
    //Nothing
}
fputcsv($handle,$content);

Test script:
---------------
//Does not work
$handle = open('test.csv','r+');
fputcsv($handle,$content);
//Work
$handle = open('test.csv','r+');
while($current = fgetcsv(handle)) {
    //Nothing
}
fputcsv($handle,$content);


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-21 16:28 UTC] felipe@php.net
-Status: Open +Status: Bogus
 [2010-04-21 16:28 UTC] felipe@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Read about the 'mode' parameter:
http://docs.php.net/manual/en/function.fopen.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC