[php-src] Issue #14308: PHP 8.1.28 curl_exec crash with no error on first request after second request is made (fast F5)
| From: | thundor | Date: | Thu, 23 May 2024 17:23:01 +0000 |
| Subject: | [php-src] Issue #14308: PHP 8.1.28 curl_exec crash with no error on first request after second request is made (fast F5) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246955@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/14308
Author: thundor
### Description
The curl_exec crashes (maybe is aborted) on a first request after another (almost instantaneous)
request has been done.
The following code must be ran twice in the same browser window.
SO: this script must be ran **TWICE** fast
```php
$url = 'https://url-to-a-big-file';
$hash = md5(microtime(true));
register_shutdown_function(function() use ($hash){
file_put_contents(DIR_LOGS . 'testlock.log', $hash . ' - ' . __LINE__ .
print_r(error_get_last(),true) . PHP_EOL, FILE_APPEND);
});
// here i have some database checks, i'll just use sleep
sleep(1);
$ch = curl_init($url);
file_put_contents(DIR_LOGS . 'testlock.log', ' - ' . $hash . ' ' .
__LINE__ . PHP_EOL, FILE_APPEND);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FILE, $fp);
file_put_contents(DIR_LOGS . 'testlock.log', ' - ' . $hash . ' ' .
__LINE__ . PHP_EOL, FILE_APPEND);
curl_exec($ch);
file_put_contents(DIR_LOGS . 'testlock.log', ' - ' . $hash . ' ' .
__LINE__ . PHP_EOL, FILE_APPEND); // NOT REACHED! No error
<?php
```
Resulted in this output:
```
the DIR_LOGS . 'testlock.log' contains both $hash-es with no errors reported.
The first hash does not contain the last file_put_contents.
```
But I expected this output instead:
```
The first request should have been completed successfully
or
the DIR_LOGS . 'testlock.log' should contain a fatal error of some kind.
```
### PHP Version
PHP 8.1.28
### Operating System
_No response_