[php-src] PR #25559: Fix curl_multi_errno() returning a stale error code
| From: | lacatoire | Date: | Wed, 18 Nov 2026 14:48:04 +0000 |
| Subject: | [php-src] PR #25559: Fix curl_multi_errno() returning a stale error code | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40778@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25559
Author: lacatoire
curl_multi_select() only saved the multi-stack error code on failure, so a success left
a previous error in place, unlike the other call sites. The CURLMOPT_PUSHFUNCTION
branch of curl_multi_setopt() also returned early on an invalid callback without saving
any error. Both now go through SAVE_CURLM_ERROR() whatever the outcome.
To reproduce:
```php
$mh = curl_multi_init();
$ch = curl_init();
curl_multi_add_handle($mh, $ch);
curl_multi_add_handle($mh, $ch); // CURLM_ADDED_ALREADY
echo curl_multi_errno($mh), "\n";
curl_multi_select($mh, 0.01);
echo curl_multi_errno($mh), "\n";
curl_multi_add_handle($mh, $ch);
echo curl_multi_errno($mh), "\n";
try {
curl_multi_setopt($mh, CURLMOPT_PUSHFUNCTION, "not a callable");
} catch (TypeError) {
}
echo curl_multi_errno($mh), "\n";
```
Before (8.4.26, 8.5.12): 7, 7, 7, 7.
After: 7, 0, 7, 10.