|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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');
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 17 05:00:01 2025 UTC |
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');