Doc #52767 [Com]: Invalid doc of FILE_APPEND|LOCK_EX for file_put_contents caused by #48522

From: Date: Mon, 23 Jan 2023 08:10:36 +0000
Subject: Doc #52767 [Com]: Invalid doc of FILE_APPEND|LOCK_EX for file_put_contents caused by #48522
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-19561@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=52767&edit=1

 ID:                 52767
 Comment by:         patric908 at gmail dot com
 Reported by:        andrzeje at wit dot edu dot pl
 Summary:            Invalid doc of FILE_APPEND|LOCK_EX for
                     file_put_contents caused by #48522
 Status:             Closed
 Type:               Documentation Problem
 Package:            Documentation problem
 PHP Version:        5.3.3
 Assigned To:        cataphract
 Block user comment: N
 Private report:     N

 New Comment:

(https://forum.codeigniter.com/member.php?action=profile&uid=65916)github.com


Previous Comments:
------------------------------------------------------------------------
[2016-01-26 22:46:06] tito dot bouzout at gmail dot com

I'm confused, can you please clarify if doing 
file_put_contents($file, $person, FILE_APPEND);
will lock the file for appending, or we need to do 
file_put_contents($file, $person, FILE_APPEND | LOCK_EX);
if we need to do the last one then please update the docs because now are giving wrong information
as reported in the other bugs mentioned here. 
http://php.net/file-put-contents

------------------------------------------------------------------------
[2010-09-08 02:18:09] cataphract@php.net

Reverses changes made in response to bogus bug #49329 and bogus bug #48522.

------------------------------------------------------------------------
[2010-09-08 02:17:07] cataphract@php.net

Automatic comment from SVN on behalf of cataphract
Revision: http://svn.php.net/viewvc/?view=revision&revision=303153
Log: - Reversing changes from revisions 288122 and 282711, which addressed bug #49329 and bug #48522
(bogus bugs).
- Closes bug #52767.

------------------------------------------------------------------------
[2010-09-02 20:15:49] andrzeje at wit dot edu dot pl

Description:
------------
In bug report #48522 gwynne@php.net said:
------
php-5.3/ext/standard/file.c:614
	if (flags & PHP_FILE_APPEND) {
		mode[0] = 'a';
	} else if (flags & LOCK_EX) {

Obviously FILE_APPEND and LOCK_EX are mutually exclusive. This is not documented!
------

OBVIOUSLY someone forget to check what is few lines below:
---BEGIN CODE---
	if (flags & LOCK_EX && (!php_stream_supports_lock(stream) || php_stream_lock(stream,
LOCK_EX))) {
----END CODE----
It seems that LOCK_EX check is independent of FILE_APPEND. However the
docs were "fixed" and now they're telling that LOCK_EX and
FILE_APPEND are mutually exclusive.

Test script:
---------------
---
From manual page: function.file-put-contents
---


Expected result:
----------------
... It's a documentation bug.

Actual result:
--------------
Once again I say... it's a DOCS bug!



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



--
Edit this bug report at https://bugs.php.net/bug.php?id=52767&edit=1


Thread (4 messages)

« previous php.doc.bugs (#19561) next »