[doc-en] master: Docs/socket exceptions (#6140)
| From: | Malek Kadri via GitHub | Date: | Wed, 25 Nov 2026 05:25:30 +0000 |
| Subject: | [doc-en] master: Docs/socket exceptions (#6140) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-24012@lists.php.net to get a copy of this message | ||
Author: Malek Kadri (malekkadri)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-11-25T06:25:27+01:00
Commit: https://github.com/php/doc-en/commit/aa0883cdbb7f8f60ba05f412cce3c8e5afc98dbe
Raw diff: https://github.com/php/doc-en/commit/aa0883cdbb7f8f60ba05f412cce3c8e5afc98dbe.diff
Docs/socket exceptions (#6140)
* Document socket_write exceptions
* Document socket_send exceptions
* Document socket_strerror exceptions
* Document socket_select exceptions
* Document socket_addrinfo_lookup exceptions
Changed paths:
M reference/sockets/functions/socket-addrinfo-lookup.xml
M reference/sockets/functions/socket-select.xml
M reference/sockets/functions/socket-send.xml
M reference/sockets/functions/socket-strerror.xml
M reference/sockets/functions/socket-write.xml
Diff:
diff --git a/reference/sockets/functions/socket-addrinfo-lookup.xml
b/reference/sockets/functions/socket-addrinfo-lookup.xml
index 6bb136c32241..fe2834934d75 100644
--- a/reference/sockets/functions/socket-addrinfo-lookup.xml
+++ b/reference/sockets/functions/socket-addrinfo-lookup.xml
@@ -61,7 +61,20 @@
On failure, &false; is returned.
</para>
</refsect1>
-
+
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ A <exceptionname>ValueError</exceptionname> is thrown if
+ <parameter>hints</parameter> contains an unrecognized string key.
+ As of PHP 8.5.0, a <exceptionname>ValueError</exceptionname> is also thrown
+ if the array contains an integer key, an unsupported address family,
+ or a value outside the allowed range for the corresponding hint.
+ A <exceptionname>TypeError</exceptionname> is thrown if a hint value
+ cannot be converted to an integer.
+ </simpara>
+ </refsect1>
+
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
diff --git a/reference/sockets/functions/socket-select.xml
b/reference/sockets/functions/socket-select.xml
index 67c07bb30283..408671c5e4f5 100644
--- a/reference/sockets/functions/socket-select.xml
+++ b/reference/sockets/functions/socket-select.xml
@@ -151,6 +151,18 @@ if (false === socket_select($r, $w, $e, 0)) {
</note>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ A <exceptionname>ValueError</exceptionname> is thrown if none of
+ <parameter>read</parameter>, <parameter>write</parameter>, and
+ <parameter>except</parameter> is a non-empty array.
+ A <exceptionname>TypeError</exceptionname> is thrown if any of these arrays
+ contains a value that is not a <classname>Socket</classname> instance,
+ or contains a closed socket.
+ </simpara>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<para>
diff --git a/reference/sockets/functions/socket-send.xml
b/reference/sockets/functions/socket-send.xml
index 9873b6493db3..b387e3b95d99 100644
--- a/reference/sockets/functions/socket-send.xml
+++ b/reference/sockets/functions/socket-send.xml
@@ -106,6 +106,14 @@
</para>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ A <exceptionname>ValueError</exceptionname> is thrown if
+ <parameter>length</parameter> is negative.
+ </simpara>
+ </refsect1>
+
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
diff --git a/reference/sockets/functions/socket-strerror.xml
b/reference/sockets/functions/socket-strerror.xml
index 8716e8e9fb67..d9b8786c6545 100644
--- a/reference/sockets/functions/socket-strerror.xml
+++ b/reference/sockets/functions/socket-strerror.xml
@@ -52,6 +52,15 @@
</para>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ A <exceptionname>ValueError</exceptionname> is thrown if
+ <parameter>error_code</parameter> is outside the range of a C
+ <type>int</type>.
+ </simpara>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<para>
diff --git a/reference/sockets/functions/socket-write.xml
b/reference/sockets/functions/socket-write.xml
index b41db730e370..555fc34eb4ae 100644
--- a/reference/sockets/functions/socket-write.xml
+++ b/reference/sockets/functions/socket-write.xml
@@ -74,6 +74,14 @@
</note>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ A <exceptionname>ValueError</exceptionname> is thrown if
+ <parameter>length</parameter> is negative.
+ </simpara>
+ </refsect1>
+
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>