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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Sat May 18 01:01:33 2024 UTC