php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #77781 fopen() b flag recommendation no longer necessary?
Submitted: 2019-03-22 12:04 UTC Modified: -
Votes:1
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: martin at auswoeger dot com Assigned:
Status: Open Package: Filesystem function related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
25 + 11 = ?
Subscribe to this entry?

 
 [2019-03-22 12:04 UTC] martin at auswoeger dot com
Description:
------------
---
From manual page: https://php.net/function.fopen
---

The documentation for fopen() includes the following note:

For portability, it is strongly recommended that you always use the 'b' flag when opening files with fopen().

However it seems that since PHP 4.3.2 the 'b' flag is already the default and it should no longer be necessary.

Looking at the source code it also seems that the 'b' flag is not necessary anymore:  
- https://github.com/php/php-src/blob/php-7.3.2/main/streams/plain_wrapper.c#L110-L114  
- https://github.com/php/php-src/commit/fa342d2404a9c809d0a182d80798da2abd3a98f7

I think this recommendation note should be removed.


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 22:01:31 2024 UTC