Commit graph

1508 commits

Author SHA1 Message Date
Ayesh Karunaratne
6f3bc59950
ext/curl: Add CURLOPT_SSL_SIGNATURE_ALGORITHMS option
Adds support for `CURLOPT_SSL_SIGNATURE_ALGORITHMS`[^1], supported
since Curl version 8.14.0.

[^1]: https://curl.se/libcurl/c/CURLOPT_SSL_SIGNATURE_ALGORITHMS.html

Closes GH-18692
2025-07-26 20:17:05 +02:00
DanielEScherzer
1eadf553f1
Arginfo: avoid using temporary zvals for initializing attribute values (#19141)
Instead of
* adding a zval on the stack
* initializing it
* copying the value to the attribute

Just initialize the value directly in the zend_attribute_arg
2025-07-21 13:33:51 -07:00
Emre Çalışkan
7fb6afbe9f
Add support for CURLINFO_QUEUE_TIME_T in curl_getinfo() (#19147)
This patch adds support for the CURLINFO_QUEUE_TIME_T constant in the
curl_getinfo() function when compiled with libcurl >= 8.6.0.

CURLINFO_QUEUE_TIME_T This constant allows retrieving the time (in
microseconds) that the request spent in libcurl’s connection queue
before it was sent.
2025-07-17 14:56:07 +02:00
Emre Çalışkan
e84320ad75
Add support for CURLINFO_CONN_ID in curl_getinfo() (#18984)
This patch adds support for the CURLINFO_CONN_ID constant in the curl_getinfo() function when compiled with libcurl >= 8.2.0.

CURLINFO_CONN_ID allows retrieving the unique identifier of the underlying connection used in the most recent transfer. This is useful for advanced features like connection reuse tracking, diagnostics, or connection pooling implementations at the PHP level.
2025-07-16 11:08:19 +02:00
Jakub Zelenka
2ecafd41ba
Remove curl OpenSSL locking for unsupported versions (#18784) 2025-07-16 11:06:21 +02:00
Daniel Scherzer
142e378618 Arginfo: add and use known strings for attribute values 2025-07-14 17:31:22 -07:00
DanielEScherzer
9225cb45ac
Make zend_register_*_constant() functions return pointers, use them (#19029)
Have each of the specialized methods for registering a constant return a
pointer to the registered constant the same way that the generic
`zend_register_constant()` function does, and use those in the generated
arginfo files to avoid needing to search for a constant that was just
registered in order to add attributes to it.
2025-07-07 12:23:52 -07:00
Niels Dossche
51149b65ad
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18990, bug #81029, bug #47314: SOAP HTTP socket not closing on object destruction
  Fix leak when path is too long in ZipArchive::extractTo()
  curl: Remove incorrect string release on error
2025-07-02 18:47:53 +02:00
Niels Dossche
764154dc75
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18990, bug #81029, bug #47314: SOAP HTTP socket not closing on object destruction
  Fix leak when path is too long in ZipArchive::extractTo()
  curl: Remove incorrect string release on error
2025-07-02 18:46:37 +02:00
Niels Dossche
11ea995ff3
curl: Remove incorrect string release on error
The string is owned by the caller, and the caller releases it.

Closes GH-18989.
2025-07-02 18:42:50 +02:00
DanielEScherzer
171501b93f
Replace @deprecated with #[\Deprecated] for internal constants (#18780)
Only covers constants declared via stub files, others will be handled
separately in a later commit.

Does not include the intl extension, since that had some errors relating to the
cpp code; that extension will be updated separately.
2025-06-26 11:27:15 -07:00
DanielEScherzer
ddd33fd7e4
Generated arginfo headers: combine preprocessor conditional blocks (2) (#18667)
When global constants' or class constants' availability is based on some
preprocessor condition, the generated arginfo header files wrap the
declarations in the preprocessor `#if` conditional blocks, one per declaration,
even if they are in the same conditional block based on comments in the stub
file. Instead of having multiple conditional blocks one after the other with
the same condition, combine them into a single conditional block.
2025-06-22 14:35:28 -07:00
Niels Dossche
89be689f77
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leaks when returning refcounted value from curl callback
2025-06-21 00:37:57 +02:00
Niels Dossche
ca487ae131
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leaks when returning refcounted value from curl callback
2025-06-21 00:37:51 +02:00
Niels Dossche
c6b058b7d2
Fix memory leaks when returning refcounted value from curl callback
Closes GH-18883.
2025-06-21 00:31:37 +02:00
Niels Dossche
029a78813d
Simplify callers of zval_try_get_long() (#18830)
Since 2b383848 references are handled properly by the Zend API, so we
can simplify the callers by removing reference handling from there.
2025-06-12 17:49:22 +02:00
Peter Kokot
ae92b85572
Fix linking ext/curl against OpenSSL (#13262)
This is backport for 8.3 of b222c020bf
that originally targeted only 8.4+. This is however a bug fix.

Following 68f6ab7113, the ext/curl doesn't
need to be linked against OpenSSL anymore, if curl_version_info_data
ssl_version is OpenSSL/1.1 or later.

With OpenSSL 3 and later the check for old SSL crypto locking callbacks
was detected here.

This also uses a common PHP_SETUP_OPENSSL macro for checking OpenSSL and
syncs the minimum OpenSSL version (currently 1.0.2 or later) across the
PHP build system.
2025-06-06 13:51:21 +02:00
Niels Dossche
a84cc91682
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak when curl_slist_append() fails
2025-05-31 11:14:19 +02:00
Niels Dossche
b2d107db4f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak when curl_slist_append() fails
2025-05-31 11:14:13 +02:00
Niels Dossche
d9d991928f
Fix memory leak when curl_slist_append() fails
If curl_slist_append() returns NULL, then the original pointer is lost
and not freed.

Closes GH-18711.
2025-05-31 11:11:54 +02:00
Ayesh Karunaratne
8e46d9a03a
ext/curl: format Caddyfile 2025-05-29 01:49:09 +05:30
David Carlier
07959fc007
Merge branch 'PHP-8.4' 2025-05-02 21:33:02 +01:00
David Carlier
351face053
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-02 21:32:20 +01:00
David Carlier
24ab0f1ea1
Fixed GH-18458: Authorization set with CURLOPT_USERPWD with NULL value.
Close GH-18460
2025-05-02 21:31:50 +01:00
David Carlier
d9d58c9d79
Revert "Fixed GH-18458: Authorization set with CURLOPT_USERPWD with NULL value."
This reverts commit bb431f124c.
2025-04-29 22:48:16 +01:00
David Carlier
bb431f124c
Fixed GH-18458: Authorization set with CURLOPT_USERPWD with NULL value. 2025-04-29 22:41:32 +01:00
David Carlier
ad65698a48
ext/curl: CURLOPT_FOLLOWLOCATION option handling.
it had been considered as boolean for years but since 8.13, it can
accept values beyond 1L, respectively CURLFOLLOW_OBEYCODE and
CURLFOLLOW_FIRSTONLY.

close GH-18444
2025-04-29 21:53:38 +01:00
David CARLIER
b233c55b12
ext/curl: curl_getinfo, curl_multi_get_handles and curl_multi_setopt array optimisations. (#18389)
mainly change to packed arrays.
2025-04-21 17:13:57 +01:00
Ayesh Karunaratne
7fd51535a4 ext/curl: add tests for CURLOPT_INFILESIZE(_LARGE) 2025-04-09 14:12:14 +07:00
Oskar Stark
195467f014 [ext-curl] Add \CURLOPT_INFILESIZE_LARGE
This is my first PR on this repository and is based on:
* https://github.com/symfony/symfony/pull/59654/files#r1935358570

So feel free to close it :-)
2025-04-09 14:12:14 +07:00
Niels Dossche
c10afa9643
Simplify curl gc handlers (#18227)
Since these objects are final and have no dynamic properties, we don't
have to build a property table.
2025-04-02 17:33:02 +02:00
Gina Peter Banyard
d8e7f362dd
ext/curl: Various minor clean-up refactorings (#18042) 2025-03-15 18:14:33 +00:00
Ayesh Karunaratne
cab120f521
ext/curl: update Caddyfile basicauth to basic_auth
In Caddy 2.8, `basicauth` was renamed to `basic_auth`.

This also applies `caddy fmt Caddyfile --overwrite` changes.
2025-03-05 16:30:59 +07:00
Ayesh Karunaratne
8e39e9c815
ext/curl: update sync-constants.php consts-ignore list 2025-03-04 21:21:00 +07:00
Christoph M. Becker
200f16fcf7
Fix GH-17855: CURL_STATICLIB flag set even if linked with shared lib
We must define `CURL_STATICLIB` only when building against a static
libcurl.  The detection relies on our usual naming conventions, what
should be revised in the future (possibly using pkg-config, or
switching to CMake).

Closes GH-17857.
2025-02-21 13:08:01 +01:00
Christoph M. Becker
9998337539
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17855: CURL_STATICLIB flag set even if linked with shared lib
2025-02-21 12:50:21 +01:00
Christoph M. Becker
07a3719bc7
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17855: CURL_STATICLIB flag set even if linked with shared lib
2025-02-21 12:49:08 +01:00
Christoph M. Becker
29c39a3d91
Fix GH-17855: CURL_STATICLIB flag set even if linked with shared lib
We must define `CURL_STATICLIB` only when building against a static
libcurl.  The detection relies on our usual naming conventions, what
should be revised in the future (possibly using pkg-config, or
switching to CMake).

Closes GH-17857.
2025-02-21 12:46:20 +01:00
Ayesh Karunaratne
6a319928c4
ext/curl: Add CURLINFO_{USED_PROXY,HTTPAUTH_USED,PROXYAUTH_USED}
Adds support for `curl_getinfo()` info keys and additional array keys:

 - [`CURLINFO_USED_PROXY`](https://curl.se/libcurl/c/CURLINFO_USED_PROXY.html) - `libcurl` >= 8.7.9 -
   Zero if no proxy was used in the previous transfer or a non-zero value if a proxy was used.
 - [`CURLINFO_HTTPAUTH_USED`](https://github.com/curl/curl/blob/curl-8_12_0/docs/libcurl/opts/CURLINFO_HTTPAUTH_USED.md) - `libcurl` >= 8.7.9 -
   Bitmask indicating the authentication method that was used in the previous HTTP request.
 - [`CURLINFO_PROXYAUTH_USED`](https://github.com/curl/curl/blob/curl-8_12_0/docs/libcurl/opts/CURLINFO_PROXYAUTH_USED.md) - `libcurl` >= 8.12.0 -
   Bitmask indicating the authentication method that was used in the previous request done over an HTTP proxy.

```php
curl_getinfo($ch);
```
```php
[
	// ...
	"used_proxy" => 0,
	"httpauth_used" => 0,
	"proxyauth_used" => 0,
]
```

This also updates the `Caddyfile` for curl tests to add a new route
that supports HTTP basic auth.
2025-02-17 17:37:27 +07:00
Ilija Tovilo
f25eb7f18d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix curl protocols test expectation
2025-02-14 14:38:58 +01:00
Ilija Tovilo
5b87faaaa7
Fix curl protocols test expectation
Closes GH-17803
2025-02-14 14:38:34 +01:00
Christoph M. Becker
dd66bb9817
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix curl_basic_022.phpt for libcurl 8.12.0
2025-02-05 19:24:37 +01:00
Christoph M. Becker
e9d4fc184d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix curl_basic_022.phpt for libcurl 8.12.0
2025-02-05 19:23:52 +01:00
Christoph M. Becker
47931a426e
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix curl_basic_022.phpt for libcurl 8.12.0
2025-02-05 19:22:51 +01:00
Christoph M. Becker
856866ef24
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix curl_basic_022.phpt for libcurl 8.12.0
2025-02-05 19:22:20 +01:00
Christoph M. Becker
36d46a4732
Fix curl_basic_022.phpt for libcurl 8.12.0
Due to a deliberate change in libcurl, the expiration is now capped to
at most 400 days.  We could solve this by choosing another date roughly
a year in the future, but would need to update the test next year.
This would be especially annoying for security branches.

Another option would be to actually parse the cookie list lines, but
that might not be worth the trouble.  Instead we just ignore the exact
timestamp created by libcurl.

[1] <https://github.com/curl/curl/pull/15937>

Closes GH-17709.
2025-02-05 19:20:47 +01:00
Christoph M. Becker
06c41ec6c5
Run curl_setopt_ssl.phpt on Windows, too (GH-16086)
The whole point of using `proc_open()` to execute `openssl s_client` is
that we can terminate the process when we're done.  However, when going
through the shell on Windows, we get a handle to the shell process, and
if we terminate that, the grandchild will stay open.  Since the pipes
of the grandchild will stay open, the PHP process will not terminate
either, so the test stalls.

We solve this by simply bypassing the shell.
2025-01-28 01:14:10 +01:00
Ayesh Karunaratne
88fc34aa7a
ext/curl: update CURLOPT_PREREQFUNCTION test to validate CURLE_ABORTED_BY_CALLBACK return value
Updates the `CURLOPT_PREREQFUNCTION` test to validate that
connections failed when the PREREQFUNC returns abort returns
CURLE_ABORTED_BY_CALLBACK as the error number.

Previously, it only checked against a hardcoded value. Now, it
checks against the `CURLE_ABORTED_BY_CALLBACK` constant as well.
2025-01-19 11:20:41 +07:00
Eric Norris
d20880ce3b
RFC: Add CurlSharePersistentHandle objects (#16937)
see https://wiki.php.net/rfc/curl_share_persistence_improvement
2025-01-06 21:52:00 +01:00
Christoph M. Becker
bb6dbdcf94
Fix curl_multi_exec() overflow message (GH-17078)
As is, passing `2147484` as `$timeout`, throws a `ValueError` stating
the `$timeout` needs to be between 0 and 2147484, what is a confusing.
Thus we report the proper threshold as float.

While we're at it we also drop the superfluous `(double)` cast, and
rely on C's usual arithmetic conversions.
2024-12-13 16:06:39 +01:00