[doc-en] master: Fix the errors and return values on the zlib pages listed in #6000 (#6050)
| From: | Alejandro Borrego via GitHub | Date: | Tue, 10 Nov 2026 17:15:02 +0000 |
| Subject: | [doc-en] master: Fix the errors and return values on the zlib pages listed in #6000 (#6050) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23932@lists.php.net to get a copy of this message | ||
Author: Alejandro Borrego (abp002)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-11-10T18:14:59+01:00
Commit: https://github.com/php/doc-en/commit/47ea59c86c44c54034c322b6b16b41a5d9865c44
Raw diff: https://github.com/php/doc-en/commit/47ea59c86c44c54034c322b6b16b41a5d9865c44.diff
Fix the errors and return values on the zlib pages listed in #6000 (#6050)
Changed paths:
M reference/zlib/functions/deflate_add.xml
M reference/zlib/functions/deflate_init.xml
M reference/zlib/functions/gzinflate.xml
M reference/zlib/functions/gzpassthru.xml
M reference/zlib/functions/gzuncompress.xml
M reference/zlib/functions/inflate-get-read-len.xml
M reference/zlib/functions/zlib-get-coding-type.xml
Diff:
diff --git a/reference/zlib/functions/deflate_add.xml b/reference/zlib/functions/deflate_add.xml
index fe5ef897e985..85e50a7018e3 100644
--- a/reference/zlib/functions/deflate_add.xml
+++ b/reference/zlib/functions/deflate_add.xml
@@ -67,10 +67,14 @@
<refsect1 role="errors"><!-- {{{ -->
&reftitle.errors;
- <para>
- If invalid arguments are given, an error of level
- <constant>E_WARNING</constant> is generated.
- </para>
+ <simpara>
+ Throws a <exceptionname>ValueError</exceptionname> if
<parameter>flush_mode</parameter>
+ is not one of the constants listed above.
+ </simpara>
+ <simpara>
+ If the data cannot be compressed, an <constant>E_WARNING</constant> is raised
+ and &false; is returned.
+ </simpara>
</refsect1><!-- }}} -->
<refsect1 role="changelog">
@@ -84,6 +88,14 @@
</row>
</thead>
<tbody>
+ <row>
+ <entry>8.0.0</entry>
+ <entry>
+ Now throws a <exceptionname>ValueError</exceptionname> if
<parameter>flush_mode</parameter>
+ is invalid. Previously, an <constant>E_WARNING</constant> was raised
+ and &false; was returned.
+ </entry>
+ </row>
<row>
<entry>8.0.0</entry>
<entry>
diff --git a/reference/zlib/functions/deflate_init.xml b/reference/zlib/functions/deflate_init.xml
index 9bdcd2697ead..9e90ce2c57f6 100644
--- a/reference/zlib/functions/deflate_init.xml
+++ b/reference/zlib/functions/deflate_init.xml
@@ -106,19 +106,29 @@
<refsect1 role="returnvalues"><!-- {{{ -->
&reftitle.returnvalues;
- <para>
- Returns a deflate context resource (<literal>zlib.deflate</literal>) on
- success, &return.falseforfailure;.
- </para>
+ <simpara>
+ Returns a <classname>DeflateContext</classname> instance on success,
+ &return.falseforfailure;.
+ </simpara>
</refsect1><!-- }}} -->
<refsect1 role="errors"><!-- {{{ -->
&reftitle.errors;
- <para>
- If an invalid option is passed to <parameter>options</parameter> or the
- context couldn't be created, an error of level <constant>E_WARNING</constant>
- is generated.
- </para>
+ <simpara>
+ Throws a <exceptionname>ValueError</exceptionname> if
<parameter>encoding</parameter>
+ is invalid, if the <literal>level</literal>, <literal>memory</literal>,
+ <literal>window</literal>, or <literal>strategy</literal> option is out
of range,
+ or if the <literal>dictionary</literal> option is an <type>array</type>
+ that contains an empty string or a string with null bytes.
+ </simpara>
+ <simpara>
+ Throws a <exceptionname>TypeError</exceptionname> if the
<literal>dictionary</literal>
+ option is neither a <type>string</type> nor an <type>array</type>.
+ </simpara>
+ <simpara>
+ If the context cannot be created, an <constant>E_WARNING</constant> is raised
+ and &false; is returned.
+ </simpara>
</refsect1><!-- }}} -->
<refsect1 role="changelog">
@@ -132,6 +142,15 @@
</row>
</thead>
<tbody>
+ <row>
+ <entry>8.0.0</entry>
+ <entry>
+ Now throws a <exceptionname>ValueError</exceptionname> or a
+ <exceptionname>TypeError</exceptionname> for an invalid
<parameter>encoding</parameter>
+ or option. Previously, an <constant>E_WARNING</constant> was raised
+ and &false; was returned.
+ </entry>
+ </row>
<row>
<entry>8.0.0</entry>
<entry>
diff --git a/reference/zlib/functions/gzinflate.xml b/reference/zlib/functions/gzinflate.xml
index 46ac6c703901..34495373de3a 100644
--- a/reference/zlib/functions/gzinflate.xml
+++ b/reference/zlib/functions/gzinflate.xml
@@ -44,11 +44,38 @@
<para>
The original uncompressed data or &false; on error.
</para>
- <para>
- The function will return an error if the uncompressed data is more than
- 32768 times the length of the compressed input <parameter>data</parameter>
- or, unless <parameter>max_length</parameter> is <literal>0</literal>,
more than the optional parameter <parameter>max_length</parameter>.
- </para>
+ </refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>ValueError</exceptionname> if
<parameter>max_length</parameter>
+ is negative. If <parameter>data</parameter> is not valid compressed data, or the
+ uncompressed data is too large for <parameter>max_length</parameter> when it is not
+ <literal>0</literal>, an <constant>E_WARNING</constant> is raised and
&false; is returned.
+ </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
<parameter>max_length</parameter>
+ is negative. Previously, an <constant>E_WARNING</constant> was raised
+ and &false; was returned.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
diff --git a/reference/zlib/functions/gzpassthru.xml b/reference/zlib/functions/gzpassthru.xml
index 5c9a369ee836..7275ea5898fa 100644
--- a/reference/zlib/functions/gzpassthru.xml
+++ b/reference/zlib/functions/gzpassthru.xml
@@ -51,10 +51,11 @@
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
- <para>
- The number of uncompressed characters read from <parameter>gz</parameter>
- and passed through to the input.
- </para>
+ <simpara>
+ The number of uncompressed characters read from <parameter>stream</parameter>
+ and passed through to the output, or <literal>-1</literal> if
<parameter>stream</parameter>
+ cannot be read, for instance because it was opened for writing.
+ </simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
diff --git a/reference/zlib/functions/gzuncompress.xml b/reference/zlib/functions/gzuncompress.xml
index f7f37a8cdb13..697a366f61f1 100644
--- a/reference/zlib/functions/gzuncompress.xml
+++ b/reference/zlib/functions/gzuncompress.xml
@@ -44,11 +44,38 @@
<para>
The original uncompressed data or &false; on error.
</para>
- <para>
- The function will return an error if the uncompressed data is more than
- 32768 times the length of the compressed input <parameter>data</parameter>
- or more than the optional parameter <parameter>max_length</parameter>.
- </para>
+ </refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>ValueError</exceptionname> if
<parameter>max_length</parameter>
+ is negative. If <parameter>data</parameter> is not valid compressed data, or the
+ uncompressed data is too large for <parameter>max_length</parameter> when it is not
+ <literal>0</literal>, an <constant>E_WARNING</constant> is raised and
&false; is returned.
+ </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
<parameter>max_length</parameter>
+ is negative. Previously, an <constant>E_WARNING</constant> was raised
+ and &false; was returned.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
diff --git a/reference/zlib/functions/inflate-get-read-len.xml
b/reference/zlib/functions/inflate-get-read-len.xml
index 599508c106dd..38502fb42eaf 100644
--- a/reference/zlib/functions/inflate-get-read-len.xml
+++ b/reference/zlib/functions/inflate-get-read-len.xml
@@ -12,12 +12,11 @@
<type>int</type><methodname>inflate_get_read_len</methodname>
<methodparam><type>InflateContext</type><parameter>context</parameter></methodparam>
</methodsynopsis>
- <para>
-
- </para>
-
- &warn.undocumented.func;
-
+ <simpara>
+ Returns the number of compressed bytes read so far from the current stream.
+ The count is reset to <literal>0</literal> by the first call to
+ <function>inflate_add</function> after the previous stream has ended.
+ </simpara>
</refsect1>
<refsect1 role="parameters">
@@ -26,9 +25,9 @@
<varlistentry>
<term><parameter>context</parameter></term>
<listitem>
- <para>
-
- </para>
+ <simpara>
+ A context created with <function>inflate_init</function>.
+ </simpara>
</listitem>
</varlistentry>
</variablelist>
@@ -36,9 +35,9 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
- <para>
- Returns number of bytes read so far&return.falseforfailure;.
- </para>
+ <simpara>
+ Returns the number of bytes read so far from the current stream.
+ </simpara>
</refsect1>
<refsect1 role="changelog">
diff --git a/reference/zlib/functions/zlib-get-coding-type.xml
b/reference/zlib/functions/zlib-get-coding-type.xml
index 4bcdf5c58d9c..5099fb9e9d40 100644
--- a/reference/zlib/functions/zlib-get-coding-type.xml
+++ b/reference/zlib/functions/zlib-get-coding-type.xml
@@ -12,9 +12,13 @@
<type
class="union"><type>string</type><type>false</type></type><methodname>zlib_get_coding_type</methodname>
<void/>
</methodsynopsis>
- <para>
- Returns the coding type used for output compression.
- </para>
+ <simpara>
+ Returns the coding type used for output compression.
+ It is chosen from the <literal>Accept-Encoding</literal> request header:
+ when <link
linkend="ini.zlib.output-compression">zlib.output_compression</link>
+ is enabled (at request start or with <function>ini_set</function>), or the
+ first time <function>ob_gzhandler</function> runs.
+ </simpara>
</refsect1>
<refsect1 role="parameters">
@@ -24,10 +28,13 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
- <para>
- Possible return values are <literal>gzip</literal>,
<literal>deflate</literal>,
- or &false;.
- </para>
+ <simpara>
+ Returns <literal>"gzip"</literal> if the
<literal>Accept-Encoding</literal>
+ request header contains <literal>gzip</literal>, otherwise
+ <literal>"deflate"</literal> if it contains
<literal>deflate</literal>.
+ Returns &false; if no coding type has been chosen yet, for instance because
+ output compression is not enabled or the header contains neither.
+ </simpara>
</refsect1>
<refsect1 role="seealso">