php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23846 Problem with fputs()
Submitted: 2003-05-28 04:48 UTC Modified: 2003-05-28 08:10 UTC
From: claudio dot pabst at ch dot abb dot com Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.3.2RC4 OS: Windows 2000 Server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: claudio dot pabst at ch dot abb dot com
New email:
PHP Version: OS:

 

 [2003-05-28 04:48 UTC] claudio dot pabst at ch dot abb dot com
I have a problem with the fputs() function.

For example:

$newarray[0] = "test123\n";
$newarray[1] = "blablabla\n";
$newarray[2] = "hello\n";
if($myfile = fopen("testfile.txt", "w")) {
foreach($newarray as $line) {
  fputs($myfile, $line, strlen($line));
}
fclose($myfile);


... a script like this works with php 4.3.1, but not with 4.3.2RC4.
Instead of a newline, the fputs function writes another ascii char. Its impossible for me, to read a file into an array after usinf fputs (php 4.3.2RC4).
Perhaps, this problem only exists on windows systems...

Regards,

Claudio

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-28 05:06 UTC] wez@php.net
fopen("testfile.txt", "wb");
                        ^
                  Use binary mode

this is a duplicate of another report and is an issue with the Apache SAPI.
 [2003-05-28 08:10 UTC] claudio dot pabst at ch dot abb dot com
i'm using the apache sapi.

thanks,

claudio
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Oct 09 23:01:26 2024 UTC