Mantis - Quercus
Viewing Issue Advanced Details
4370 major always 02-01-11 08:05 02-02-11 04:15
geleont  
domdorn  
normal  
resolved 4.0.14  
fixed  
none    
none  
0004370: file_get_contents in quercus 4.0.11 has bug.
Minimal code to reproduce:
<?php
file_put_contents("123", "Hello",LOCK_EX);
?>
Cause
java.lang.NullPointerException
com.caucho.quercus.lib.file.FileOutput.unlock(FileOutput.java:197)
com.caucho.quercus.lib.file.FileModule.flock(FileModule.java:1087)
com.caucho.quercus.lib.file.FileModule.file_put_contents(FileModule.java:1045)
I reviewed source code of quercus FileModule module and I am sure it happens because we close [B]os[/B], which is linked on the same object as s(BinaryOutput os = (BinaryOutput) s;) and after that we trying to make
 flock(env, (LockableStream) s, LOCK_UN, null);
on that stream.IN file_put_contents function from FileModule

Notes
(0005013)
domdorn   
02-02-11 03:12   
reproducible.
(0005014)
domdorn   
02-02-11 04:15   
fixed in svn-trunk, r7876.