if you are used to reply with qualified error messages by using "track_errors = 1" and $php_errormsg, flock() will nark you, if you use LOCK_NB .
If flock() fails due to LOCK_NB $php_errormsg will not be created and filled with an error message like 'could not lock file, file already locked'.
You can use some little workaround which does also on WIN:
#---------------------------------
GLOBAL $MYERRORMSG;
function some_file_operations($filename)
{
GLOBAL $MYERRORMSG;
# ...
# ...
if (! @flock($fh, LOCK_SH | LOCK_NB, $wb))
{
if (!isset($php_errormsg)) $php_errormsg = 'could not lock file, file already locked';
$MYERRORMSG = $php_errormsg;
return false;
}
}
#--------------------------------
In case of fail $MYERRORMSG now will hold a qualified error message