Hi all,
as of PHP 7.4.0 with libcurl >= 7.56.0, CurlFile accepts any supported
stream URLs (formerly it only accepted file names). There is, however,
a bug in the current implementation which breaks the upload for copied
cURL handles (curl_copy_handle()). A pull request to fix this[1] is
available.
Now the question came up, whether we should open these streams lazily
(i.e. only when libcurl needs it; basically the same behavior like PHP
7.3), or whether the streams should be opened in advance. The latter
would have the advantage that we easily could resolve bug #79013[2]
(which may not be a bug at all), but the drawback that there may be more
open streams than strictly necessary.
I tend to prefer the current solution (i.e. open the streams lazily),
but would like to hear more opinions on that.
[1]
https://github.com/php/php-src/pull/5045/commits/726db27d1cb9023ec6f474d9bc5a7250a6e2386b
[2] https://bugs.php.net/79013
Thanks,
Christoph