From:             
Operating system: Windows Server 2003
PHP version:      Irrelevant
Package:          *Directory/Filesystem functions
Bug Type:         Bug
Bug description:REQUIRE_ONCE,REQUIRE,INCLUDE & INCLUDE_ONCE do not handle flock 
correctly

Description:
------------
When an exclusive lock is set on a file (flock) importing the file from any
script (including the script itself) with require,require_once,include or
.

include_once silently fails and imports nothing. 

Trying to lock the file from the same script works as expected.

Test script:
---------------
<?php //setLock.php

$theFile = fopen('thefile.html', 'rb'); //template file

flock($theFile, LOCK_EX); //accuire an exclusive lock on the file

sleep(10);

echo(require('someFile'));       <-- this silently fails

flock($theFile, LOCK_UN );//release the lock

echo(require('someFile'));       <-- this succeeds

phpinfo(); ?>

//////////////////////////////////////////////////////////////////////////////

<?php //getTheLockedFile.php

echo(require('someFile');) <-- this silently fails

?>

Expected result:
----------------
When excecuting setlock.php I expect it to succeed on both instances or die
with the first require attempt



when simultaneously excecuting getTheLockedFile.php I expect excecution to
be halted untill the setLock.php file completes or to die with an error.

Actual result:
--------------
When excecuting setlock.php the first require attempt fails silently
(return 

value 1, no error) the seccond attempt succeeds as normal.



when simultaneously excecuting getTheLockedFile.php the require attempt
fails silently (return value 1, no error)

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

Reply via email to