Bug #52366 [Opn->Asn]: flock() fails on gzopen()'d file pointer
| From: | aharvey@php.net | Date: | Mon, 19 Jul 2010 03:48:13 +0000 |
| Subject: | Bug #52366 [Opn->Asn]: flock() fails on gzopen()'d file pointer | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4705@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52366&edit=1
ID: 52366
Updated by: aharvey@php.net
Reported by: richard at on-the dot net
Summary: flock() fails on gzopen()'d file pointer
-Status: Open
+Status: Assigned
Type: Bug
-Package: Streams related
+Package: Documentation problem
Operating System: ubuntu
PHP Version: 5.3.2
-Assigned To:
+Assigned To: aharvey
New Comment:
flock() only works on file resources and userspace streams that
implement the stream_lock() method. Internally, gzopen() actually
returns a gzip stream, rather than a file stream.
I'll update the flock() manual page to make the limitations on the
stream types supported clearer.
Previous Comments:
------------------------------------------------------------------------
[2010-07-17 17:21:02] richard at on-the dot net
Description:
------------
Documentation for gzopen() says it returns a file pointer so I expected
flock() to work on that file pointer but it doesn't.
Test script:
---------------
<?php
$fp = gzopen("filename",'wb');
if (!$fp) die("gzopen() failed\n");
if (!flock($fp,LOCK_EX)) die("flock() failed\n");
print "Success\n";
?>
Expected result:
----------------
Success
Actual result:
--------------
flock() failed
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52366&edit=1