#015922: File backend lock function expects lock timeout argument as seconds, milliseconds passed
Description:
public function lock( $waitTime, $timeout )
{
...
while ( ( $fp = @fopen( $lockFileName, 'x' ) ) === false )
{
// This is untestable.
if (** microtime( true ) - $lockStart **> $timeout )
{
// Release timed out lock
unlink( $lockFileName );
$lockStart = microtime( true );
}
else
{
usleep( $waitTime );
}
}
The function gets milliseconds as $timeout, but the highlighted text will return seconds.
Environment:
Operating System: Linux 2.6.31-16-generic #52-Ubuntu SMP
PHP Version: (please be specific, like '4.4.3' or '5.1.5'): 5.2.1
Client: Cadaver
Steps to Reproduce:
1. Create a fake .ezc_lock file in the path to the backend
2. Try to edit any file
3. Will never release and aquire the lock
Also suggesting cleaning up of aquireLock function, the argument is never used, neither is the return parameters afaik.
Supplied a patch for file backend, file backend options (the waitForLock option is no longer used) and file plugin options (set the timeout to seconds instead of milliseconds)