php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #43363 Incorrect documentation for ZipArchive::locateName
Submitted: 2007-11-21 16:18 UTC Modified: 2007-11-22 00:07 UTC
From: nick at magic-wand dot net Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: N/A
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nick at magic-wand dot net
New email:
PHP Version: OS:

 

 [2007-11-21 16:18 UTC] nick at magic-wand dot net
Description:
------------
Example 2704 on the documentation page for ZipArchive::locateName incorrectly tests for equivalence with true for the zip->open() operation. This causes the example to exit when there's no error.

Reproduce code:
---------------
Lines 18-20 currently read:

if ($zip->open($file) === TRUE) {
    exit('failed');
}

They should read:

if ($zip->open($file) !== TRUE) {
    exit('failed');
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-22 00:07 UTC] felipe@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.


 [2011-05-20 19:03 UTC] m021 at springtimesoftware dot com
I believe the example is still incorrect, since this function is never documented to return TRUE (any comparison with TRUE may therefore not work properly).

The comparison should be made with FALSE, which is the value returned when no entry with that name is found.

Example: if ($zip->open($file)===FALSE)
            exit('no such entry found in the zip file');
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 20:01:34 2024 UTC