Bug #60232 [Opn->Bgs]: Wrong lock support detection for streams

From: Date: Tue, 29 Nov 2011 13:30:09 +0000
Subject: Bug #60232 [Opn->Bgs]: Wrong lock support detection for streams
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-165555@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60232&edit=1

 ID:                 60232
 Updated by:         iliaa@php.net
 Reported by:        goetas at lignano dot it
 Summary:            Wrong lock support detection for streams
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Streams related
 Operating System:   ubuntu
 PHP Version:        5.3.8
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

The stream_support_locking() merely checks if stream->fd is present, it does not 
"actually" check if locking is supported. Therefor the check is actually correct.


Previous Comments:
------------------------------------------------------------------------
[2011-11-16 19:26:12] goetas at lignano dot it

in file.c there is a double check for stream locking support, but the first check is done in the
worong way. 
i'm not a c programmer, i think that should be done somethink like this

if(file_lock) then
   if(is_stream && !stream_support_locking) then
     throw error
   endif
endif

------------------------------------------------------------------------
[2011-11-16 12:32:17] felipe@php.net

The first check was introduced to fix the issue reported in bug #44501.

------------------------------------------------------------------------
[2011-11-07 12:04:03] goetas at lignano dot it

Description:
------------
I have implemented my own stream that support locking (defined the function stream_lock). 
when use: 
file_put_contents("sqlfile://www.pppoa.it/x", "", LOCK_EX);

I get this error: Exclusive locks may only be set for regular files

I've take a look into PHP_5_3/ext/standard/file.c,  and at line 620 there is a check, that
generates this error.

Few lines after, at line 635 there is a second check, for stream lock support.
But these lines of code (635...) is newer reachable because all operations on stream that require
locking will stop on line 623.






------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60232&edit=1


Thread (7 messages)

« previous php.bugs (#165555) next »