file_put_contents() and flock() error 'out of free disk space '
<p>I run this test script</p>

<pre><code>&lt;?php
function LockData($file,$locker=LOCK_EX){
    static $streams=array();
    $md=md5($file);

    if(empty($streams[$md])){
        $streams[$md]=fopen($file,'a+');
    }
    $i=0;
    do{
        $lock=flock($streams[$md],$locker);
    }while(!$lock &amp;&amp; ++$i&lt;=3);

    return $lock;
}

function ReadData($file){
    if(is_file($file)){
        $lock=LockData($file);
        if(!$lock) return false;

        $data=@file_get_contents($file);

        if(!empty($data)){
            return unserialize(str_replace('&lt;?die;?&gt;',"",$data));
        }
    }
    return false;
}

function WriteData($file,$data){
    file_put_contents($file,'&lt;?die;?&gt;'.serialize($data));

    LockData($file,LOCK_UN);
}

$fp=ReadData($file="test.txt");

if(!$fp)$fp=array();
print_r($fp);
$fp[]="2";
WriteData($file,$fp);
</code></pre>

<p>And if I use the LockData() function I have a error "Warning: file_put_contents() [function.file-put-contents]: Only 0 of 26 bytes written, possibly out of free disk space"
Don't understand this...</p>