From:             
Operating system: Win7/64
PHP version:      5.3.10
Package:          Filesystem function related
Bug Type:         Bug
Bug description:LOCK_EX in file_put_contents with custom streamwrapper fails

Description:
------------
Currently I'm using a custom Streamwrapper for memcached access. The
wrapper works 
fine unless I'm using the LOCK_EX parameter for file_put_contents. 

If the parameter is given the function does neither write the file nor
calls a 
method of the streamwrapper. I included simple echo statements in all
methods of 
the streamwapper but no output is shown. 

I have done this because there is no documentation about which
streamwrapper 
methods are called during file_put_contents. I ASSUME that it should call 
stream_lock like flock() does - but as mentioned before there is no output
at all.

Test script:
---------------
class MyWrapper { 
   // Assume other methods are implemented

   // Just for demonstration 
   public function stream_lock($operation) {
        echo "I've been called";
    }
}

stream_register_wrapper('myWrapper, 'MyWrapper');
$result = file_put_contents('myWrapper://myFile','content',LOCK_EX);
echo $result; 

Expected result:
----------------
true
(file is written)

Actual result:
--------------
false
(file is not written)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=61201&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=61201&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=61201&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=61201&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=61201&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=61201&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=61201&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=61201&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=61201&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=61201&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=61201&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=61201&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=61201&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=61201&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=61201&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=61201&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=61201&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=61201&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=61201&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=61201&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=61201&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=61201&r=mysqlcfg

Reply via email to