[doc-en] master: zip: document the ValueError thrown by ZipArchive::close() (#6060)
| From: | Tiago Cruz via GitHub | Date: | Wed, 11 Nov 2026 19:28:49 +0000 |
| Subject: | [doc-en] master: zip: document the ValueError thrown by ZipArchive::close() (#6060) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23935@lists.php.net to get a copy of this message | ||
Author: Tiago Cruz (TiagoCruz1224)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-11-11T20:28:46+01:00
Commit: https://github.com/php/doc-en/commit/bdf8f3b65c6c344e9076cae08721aec963858175
Raw diff: https://github.com/php/doc-en/commit/bdf8f3b65c6c344e9076cae08721aec963858175.diff
zip: document the ValueError thrown by ZipArchive::close() (#6060)
As of PHP 8.0.0 (php-src 3c16606d46, "Elevate warning to ValueError for
invalid ZipArchive object"), ZipArchive::close() throws a ValueError if
the archive is not open, for example when it was never opened or was
already closed. Before that, it raised an E_WARNING and returned false.
The page had no Errors section and no changelog for this.
Fixes #6047
Changed paths:
M reference/zip/ziparchive/close.xml
Diff:
diff --git a/reference/zip/ziparchive/close.xml b/reference/zip/ziparchive/close.xml
index d22285387306..6cdd70c4a888 100644
--- a/reference/zip/ziparchive/close.xml
+++ b/reference/zip/ziparchive/close.xml
@@ -45,6 +45,38 @@
</simpara>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>ValueError</exceptionname> if the archive is not
+ open, for example because it was never opened or has already been closed.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>8.0.0</entry>
+ <entry>
+ Now throws a <exceptionname>ValueError</exceptionname> if the archive
+ is not open. Previously, an <constant>E_WARNING</constant> was raised
+ and &false; was returned.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </refsect1>
+
<refsect1 role="seealso">
&reftitle.seealso;
<para>