#49329 [Opn->Csd]: file_put_contents() Example #2 : FILE_APPEND and LOCK_EX are exclusive

From: Date: Mon, 07 Sep 2009 06:37:12 +0000
Subject: #49329 [Opn->Csd]: file_put_contents() Example #2 : FILE_APPEND and LOCK_EX are exclusive
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2736@lists.php.net to get a copy of this message
ID: 49329 Updated by: torben@php.net Reported By: contact at pascal-martin dot fr -Status: Open +Status: Closed Bug Type: Documentation problem PHP Version: Irrelevant New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2009-09-07 06:36:11] svn@php.net Automatic comment from SVN on behalf of torben Revision: http://svn.php.net/viewvc/?view=revision&revision=288122 Log: Removed a redundant use of LOCK_EX with FILE_APPEND in an example. Addresses bug #49329. ------------------------------------------------------------------------ [2009-08-22 15:00:36] contact at pascal-martin dot fr Description: ------------ The documentation page of file_put_contents states that : * FILE_APPEND is mutually exclusive with LOCK_EX since appends are atomic and thus there is no reason to lock. * LOCK_EX is mutually exclusive with FILE_APPEND. (It seems this is stated since bug #48522 has been corrected) Still, the Example #2 given is like this : <?php $file = 'people.txt'; // The new person to add to the file $person = "John Smith\n"; // Write the contents to the file, // using the FILE_APPEND flag to append the content to the end of the file // and the LOCK_EX flag to prevent anyone else writing to the file at the same time file_put_contents($file, $person, FILE_APPEND | LOCK_EX); ?> If FILE_APPEND and LOCK_EX are exclusive, and "appends are atomic and thus there is no reason to lock", only the first one should be included in that example. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49329&edit=1

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