[doc-en] master: curl_setopt(_array): document ValueError for invalid options (#5922)

From: Date: Fri, 09 Oct 2026 10:38:48 +0000
Subject: [doc-en] master: curl_setopt(_array): document ValueError for invalid options (#5922)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23822@lists.php.net to get a copy of this message
Author: Satvik Mishra (SatvikMishra08) Committer: GitHub (web-flow) Pusher: lacatoire Date: 2026-10-09T12:38:45+02:00 Commit: https://github.com/php/doc-en/commit/0c5b5b90e55baccbeb577a24696726d3fb466c74 Raw diff: https://github.com/php/doc-en/commit/0c5b5b90e55baccbeb577a24696726d3fb466c74.diff curl_setopt(_array): document ValueError for invalid options (#5922) * curl_setopt(_array): document ValueError for invalid options Add Errors sections and PHP 8.0.0 changelog entries noting that invalid cURL options now throw ValueError instead of emitting E_WARNING (php/php-src#5963 / PHP 8 internal function exceptions). Closes #3119 * Apply review suggestions; use simpara in Errors sections Changed paths: M reference/curl/functions/curl-setopt-array.xml M reference/curl/functions/curl-setopt.xml Diff: diff --git a/reference/curl/functions/curl-setopt-array.xml b/reference/curl/functions/curl-setopt-array.xml index a52b171179d7..8aacec7e8559 100644 --- a/reference/curl/functions/curl-setopt-array.xml +++ b/reference/curl/functions/curl-setopt-array.xml @@ -47,6 +47,14 @@ </para> </refsect1> + <refsect1 role="errors"> + &reftitle.errors; + <simpara> + Throws a <exceptionname>ValueError</exceptionname> when + <parameter>options</parameter> contains an invalid cURL option. + </simpara> + </refsect1> + <refsect1 role="changelog"> &reftitle.changelog; <informaltable> @@ -58,6 +66,17 @@ </row> </thead> <tbody> + <row> + <entry>8.0.0</entry> + <entry> + <function>curl_setopt_array</function> now throws a + <exceptionname>ValueError</exceptionname> if + <parameter>options</parameter> contains an unknown option or a + string key. Previously, unknown options were silently ignored, and a + string key emitted an <constant>E_WARNING</constant> and returned + &false;. + </entry> + </row> &curl.changelog.handle-param; </tbody> </tgroup> diff --git a/reference/curl/functions/curl-setopt.xml b/reference/curl/functions/curl-setopt.xml index 0ea60e36df5d..59d50155492f 100644 --- a/reference/curl/functions/curl-setopt.xml +++ b/reference/curl/functions/curl-setopt.xml @@ -54,6 +54,14 @@ </para> </refsect1> + <refsect1 role="errors"> + &reftitle.errors; + <simpara> + Throws a <exceptionname>ValueError</exceptionname> when + <parameter>option</parameter> is not a valid cURL option. + </simpara> + </refsect1> + <refsect1 role="changelog"> &reftitle.changelog; <para> @@ -73,6 +81,17 @@ and enabling it on thread-safe PHP builds no longer triggers a warning. </entry> </row> + <row> + <entry>8.0.0</entry> + <entry> + <function>curl_setopt</function> now throws a + <exceptionname>ValueError</exceptionname> if + <parameter>option</parameter> is not a valid cURL option. + Previously, unknown options were silently ignored, and an + <constant>E_WARNING</constant> was emitted, with &false; returned, + only for values less than or equal to zero. + </entry> + </row> &curl.changelog.handle-param; <row> <entry>7.3.15, 7.4.3</entry>

« previous php.doc.cvs (#23822) next »