|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9282 printint chr(0x0a) in a file generate 0x0d 0x0a
Submitted: 2001-02-15 10:36 UTC Modified: 2001-02-15 10:48 UTC
From: Olivier dot Ziller at univ-nancy2 dot fr Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.0.4pl1 OS: Win32
Private report: No CVE-ID: None
 [2001-02-15 10:36 UTC] Olivier dot Ziller at univ-nancy2 dot fr
look at the following code :

  $s = chr(0x0a);
  print strlen($s);
  $fp =fopen("test.txt","w");

the output on screen is 1(strlen($s)) but in my file, i get always 0x0d 0x0a.
With Unix, i get only 0x0a in my file.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-15 10:48 UTC]
this is how windows (aka MS-DOS) works,
to write transparent binary to a file you have to 
open it with mode "wb" instead of "w"
(unix will accept the 'b' too although it has no effect there)
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 06:01:27 2019 UTC