Bug #54129 [NEW]: using LOCK_NB whilst aquiring a lock with flock() does work on windows
| From: | scope at planetavent dot de | Date: | Tue, 01 Mar 2011 15:59:28 +0000 |
| Subject: | Bug #54129 [NEW]: using LOCK_NB whilst aquiring a lock with flock() does work on windows | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-6040@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows Server 2008 (x64)
PHP version: 5.3.5
Package: Documentation problem
Bug Type: Bug
Bug description:using LOCK_NB whilst aquiring a lock with flock() does work on windows
Description:
------------
The online documentation states that LOCK_NB to achieve a non-blocking
lock-attempt is not supported on windows.
The given test script, if started twice, just returns stating that the lock
can not be aquired. Therefor, since it does not block, using LOCK_NB seems
to work on windows and the documentation should be updated accordingly. If
this is not the expected behaviour, the documentation should reflect the
possible situations, where using LOCK_NB does indeed not work.
Furthermore the statement "The automatic unlocking when the file's resource
handle is closed was removed. Unlocking now always has to be done
manually." should be checked. My test show that closing the file pointer
with fclose() does release the lock.
Test script:
---------------
<?php
$lockfile = 'dummy.lock';
$fp = fopen( $lockfile, 'w+' );
if ( !$fp )
{
echo "unable to open lockfile\n";
exit;
}
if ( !flock( $fp, LOCK_EX | LOCK_NB ) )
{
echo "unable to aquire lock\n";
exit;
}
sleep( 10 );
Expected result:
----------------
According to documentation, script should block (since LOCK_NB is not
supported)
Actual result:
--------------
flock does not block
--
Edit bug report at http://bugs.php.net/bug.php?id=54129&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54129&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54129&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54129&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54129&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54129&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54129&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54129&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54129&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54129&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54129&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54129&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54129&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54129&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54129&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54129&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54129&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54129&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54129&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54129&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54129&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54129&r=mysqlcfg