php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #52366 flock() fails on gzopen()'d file pointer
Submitted: 2010-07-17 17:21 UTC Modified: 2010-07-19 06:30 UTC
From: richard at on-the dot net Assigned: aharvey (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.2 OS: ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: richard at on-the dot net
New email:
PHP Version: OS:

 

 [2010-07-17 17:21 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-19 05:48 UTC] aharvey@php.net
-Status: Open +Status: Assigned -Package: Streams related +Package: Documentation problem -Assigned To: +Assigned To: aharvey
 [2010-07-19 05:48 UTC] aharvey@php.net
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.
 [2010-07-19 05:48 UTC] aharvey@php.net
-Type: Bug +Type: Documentation Problem
 [2010-07-19 06:30 UTC] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=301386
Log: Fix doc bug #52366 (flock() fails on gzopen()'d file pointer) by making it
clearer that flock() only works on actual file handles. Also fixed a couple of
grammatical problems, and added a more detailed explanation of when mandatory
locking will be used that's hopefully more or less accurate.
 [2010-07-19 06:30 UTC] aharvey@php.net
-Status: Assigned +Status: Closed
 [2010-07-19 06:30 UTC] aharvey@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 18 15:00:02 2025 UTC