#49329 [NEW]: file_put_contents() Example #2 : FILE_APPEND and LOCK_EX are exclusive
| From: | contact at pascal-martin dot fr | Date: | Sat, 22 Aug 2009 15:00:37 +0000 |
| Subject: | #49329 [NEW]: file_put_contents() Example #2 : FILE_APPEND and LOCK_EX are exclusive | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-2646@lists.php.net to get a copy of this message | ||
From: contact at pascal-martin dot fr
Operating system:
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: file_put_contents() Example #2 : FILE_APPEND and LOCK_EX are exclusive
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 bug report at http://bugs.php.net/?id=49329&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49329&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49329&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49329&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49329&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49329&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49329&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49329&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49329&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49329&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49329&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49329&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49329&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49329&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49329&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49329&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49329&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49329&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49329&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49329&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49329&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49329&r=mysqlcfg