Re: PHP 4.0 Bug #7554: Exclusive flock() breaks client/servercommunication

From: Date: Wed, 01 Nov 2000 03:24:49 +0000
Subject: Re: PHP 4.0 Bug #7554: Exclusive flock() breaks client/servercommunication
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-36573@lists.php.net to get a copy of this message
Try this instead: if (!flock($fp2, (LOCK_EX|LOCK_NB)) die("cant lock file 2"); See the manual for more info. (http://www.php.net/manual/function.flock.php) On Tue, 31 Oct 2000, Daniel T. Gorski wrote the following to Ignacio...: > Hi all, > > > $fp1 = fopen("/tmp/test.txt","a"); > > if (!$fp1) die("cant open file 1"); > > if (!flock($fp1,2)) die("cant lock file 1"); > > > > $fp2 = fopen("/tmp/test.txt","a"); > > if (!$fp2) die("cant open file 2"); > > > > // causes troubles > > if (!flock($fp2,2)) die("cant lock file 2"); > > [...] > > > Are you sure that it isn't blocking on the second fopen()? That's what > > locking is supposed to do. > > this second fopen() provides a valid file handle (as expected), the second > flock($fp2,LOCK_EX) on this previously exclusiv-locked file should return > "false" or should die() with a message in this case - right? - it doesn't. > The client-browser is trying (seems infitely) to receive data - or in other > words this script doesn't terminate. I tried it with 4.0.1pl2 now - same > effect. > > yours dtg > > > > > >

« previous php.dev (#36573) next »