For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > June 2007 > #41609 [Bgs->Opn]: file_put_contents() injects \r









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #41609 [Bgs->Opn]: file_put_contents() injects \r
pajoye@php.net

2007-06-11, 6:59 pm

ID: 41609
Updated by: pajoye@php.net
Reported By: zoe at uk dot ibm dot com
-Status: Bogus
+Status: Open
-Bug Type: Filesystem function related
+Bug Type: Documentation problem
Operating System: Windows XP
PHP Version: 6CVS-2007-06-06 (snap)
New Comment:

"*IF* there is some work needed on the docs is the right process to
open another defect?"

Good point, there is a lot of work to be done regarding php6 behaviors
of each function. I'm not sure what the phpdoc team decided but I will
let them comment here, if required.

changed to open + documentation problem.




Previous Comments:
------------------------------------------------------------------------

[2007-06-11 11:30:25] zoe at uk dot ibm dot com

Fair enough - I was wondering if it should also be either RTFM or
WTFM?
Just had a quick look at what I hope are the PHP6 docs and I can't see
the new put_file_contents() flags documented yet. *IF* there is some
work needed on the docs is the right process to open another defect?

------------------------------------------------------------------------

[2007-06-11 10:58:07] pajoye@php.net

Not a bug > bogus (I don't like this word but well :)

------------------------------------------------------------------------

[2007-06-11 09:56:24] zoe at uk dot ibm dot com

Yes - you are right. The FILE_BINARY flag does fix the problem. I'm
closing this.

------------------------------------------------------------------------

[2007-06-09 21:17:40] pajoye@php.net

"when files are not opened with the binary flag, windows automatically
converts \n to \r\n. I don't have time until mid-July to investigate
this problem though."

As far as I remember, it is the documented behavior (windows file
functions).

It is especially important to take care of text contents in the unicode
mode, it is not a good idea to blindly save everything as binary. That's
why php6 has two new flags which can be used in file_put_contents:
- FILE_TEXT, opens with "wt" (or "at" if FILE_APPEND is used)
- FILE_BINARY, opens with "wb" (or "ab"

the default mode is "w", which is a text mode on windows.

I do not have a windows at hand to test but I'm pretty sure that
FILE_BINARY solves your issue. It may use it automatically when a binary
string is given, but I would find that trickier (magic++).

------------------------------------------------------------------------

[2007-06-09 21:03:19] nlopess@php.net

when files are not opened with the binary flag, windows automatically
converts \n to \r\n. I don't have time until mid-July to investigate
this problem though.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/41609

--
Edit this bug report at http://bugs.php.net/?id=41609&edit=1
Encejohader48

2007-06-13, 1:03 pm

Jessica Alba and Christina Aguilera Lesbians In Fishnets And Boots!
http://www.WatchingTheTube.com/PlayFile?movie=1673286
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com