php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80292 Incorrect use of code in manual's example codes.
Submitted: 2020-10-28 12:27 UTC Modified: 2020-10-28 12:56 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: astrixoblix dot b at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Zip Related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2020-10-28 12:27 UTC] astrixoblix dot b at gmail dot com
Description:
------------
---
From manual page: https://php.net/ziparchive.locatename
---

In example #1 line #13 there's an additional exclamation mark by mistake.
I supposed the code has been changed from !$zip->status to $zip->status != ZipArchive::ER_OK but correct code got lost during patches.


affected line:
if (!$zip->status == ZipArchive::ER_OK) {


correct line:
if ($zip->status != ZipArchive::ER_OK) {


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-28 12:53 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: Documentation problem +Package: Zip Related -Assigned To: +Assigned To: cmb
 [2020-10-28 12:56 UTC] cmb@php.net
Well, to clarify, the code works as it should because it is
equivalent to:

    if (!($zip->status == ZipArchive::ER_OK)) {

However, that is clumsy and misleading.
 [2020-10-28 13:12 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=3f1917852ecf1a1dbf126d4bee4ef0d918653056
Log: Fix #80292: Incorrect use of code in manual's example codes
 [2020-10-28 13:12 UTC] phpdocbot@php.net
-Status: Verified +Status: Closed
 [2020-10-28 22:35 UTC] phpdocbot@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=81aadfbc60ebfbd546c97f9c4ce04c68daaf1f34
Log: Fix #80292: Incorrect use of code in manual's example codes
 [2020-12-30 11:58 UTC] nikic@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=8fc7cc2eedd04794b66535806cb4fa29cc2a7c0a
Log: Fix #80292: Incorrect use of code in manual's example codes
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 06:01:30 2024 UTC