Commit graph

680 commits

Author SHA1 Message Date
Arnaud Le Blanc
11accb5cdf
Preferably include from build dir (#13516)
* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
2024-06-26 00:26:43 +02:00
Niels Dossche
7e2d47d2b8 curl: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Gina Peter Banyard
bb2fae1ffc ext/curl: Fix [-Wsign-compare] warning 2024-06-06 16:18:23 +01:00
Ilija Tovilo
d2a9edfee6
Callable curl options should be nullable
symfony/http-client/Response/CurlResponse.php depends on this behavior.

Closes GH-14165
2024-05-07 16:34:49 +02:00
Gina Peter Banyard
f4dbe2390d
ext/curl: Refactor cURL to only use FCC (#13291)
* ext/curl: Convert handlers.progress to just be a FCC

* ext/curl: Convert handlers.sshhostkey to just be a FCC

* ext/curl: Convert handlers.xferinfo to just be a FCC

* ext/curl: Convert handlers.fnmatch to just be a FCC

* ext/curl: Convert handlers.server_push to just be a FCC

* ext/curl: Convert php_curl_write to just use FCC without a function name zval

* ext/curl: Convert php_curl_read to just use FCC without a function name zval

* ext/curl: Remove workaround for old libcurl

* ext/curl: Create macros to codegen the handling of callable options
2024-05-01 15:09:11 +01:00
Ayesh Karunaratne
ba0f9fb501
ext/curl: Add feature_info assoc array to curl_version() (#13439)
The `phpinfo()` section of the Curl extension lists individual features
supported by the particular ext-Curl + libcurl build. However, the
`curl_version()` function return values do not indicate the same level of
details.

`curl_version()` has a `protocols` key that returns an array of all protocols
supported by the build. But the `features` key is a bitmask of all the features.
Checking the availability of certain feature requires knowing the corresponding
`CURL_VERSION` constant, and checking the availability of the constant and a
bitmask check for it in the `features` value.

For example, to determine HTTP2 support, it requires evaluating:

```php
defined('CURL_VERSION_HTTP2') && (curl_version()['features'] & CURL_VERSION_HTTP2 === CURL_VERSION_HTTP2)
```

To make feature availability checks more intuitive, this adds a new
`feature_list` key to `curl_version()` output array.

With it, checking for individual features availability is easier, and does
not require inspecting the availability of the `CURL_VERSION` constant and
the `features` key.

```php
!empty(curl_version()['feature_list']['HTTP2']);
```
2024-02-21 00:46:22 +00:00
Ayesh Karunaratne
edb9f65f16
ext/curl: Bump minimum Curl version to >= 7.61.0 (#13259)
Bumps the minimum required libcurl version to 7.61.0.

Please also see #4917, which bumped minimum libcurl version to the current >= 7.29.0.
This bumps the minimum requirement to Curl 7.61.0 (released 2018 Sept).

Ubuntu, Debian, RHEL, and RHEL derivatives have major and LTS version bumps this year. Following are the
libcurl-dev/libcurl-devel versions available in the oldest supported (LTS or otherwise) in major OSs.

 - Debian buster: [7.64](https://packages.debian.org/buster/libcurl4-openssl-dev)
 - Ubuntu 20.04: [7.68](https://packages.ubuntu.com/focal/libcurl-dev)
 - CentOS/RHEL 7: 7.29
 - RHEL 8/Rocky 8/EL 8: 7.61
 - Fedora 38: 7.87

RHEL/CentOS 7 reaches EOL mid 2024, so for PHP 8.4 scheduled towards the end of this year, we can safely
bump the minimum libcurl version.

7.61.0 was selected as the new minimum because RHEL and derivatives have libcurl-devel version 7.61. RHEL 8 is
a current and supported RHEL version.
2024-01-31 13:48:17 +00:00
Niels Dossche
de60872cfd
Add new curl constants from curl until (including) 7.87 (#10459)
Fixes GH-10454
2023-07-17 20:42:39 +02:00
nielsdos
18f2f0a0ab Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-11433: Unable to set CURLOPT_ACCEPT_ENCODING to NULL
  Fix "invalid state error" with cloned namespace declarations
  Fix lifetime issue with getAttributeNodeNS()
2023-06-13 17:38:04 +02:00
nielsdos
c160693515 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11433: Unable to set CURLOPT_ACCEPT_ENCODING to NULL
  Fix "invalid state error" with cloned namespace declarations
  Fix lifetime issue with getAttributeNodeNS()
2023-06-13 17:35:16 +02:00
nielsdos
a8a3b99e00 Fix GH-11433: Unable to set CURLOPT_ACCEPT_ENCODING to NULL
Closes GH-11446.
2023-06-13 17:30:57 +02:00
George Peter Banyard
d5ad75108e
More usage of known zend_str instead of C string (#11381) 2023-06-08 13:03:29 +01:00
George Peter Banyard
ad997987dd
ext/curl: Protocol should be a case insensitive check (#11052)
Minor drive-by refactoring to use the new API
2023-04-11 11:45:05 +01:00
Ilija Tovilo
7b4c7374c3
Merge branch 'PHP-8.2'
* PHP-8.2:
  ext/curl: suppress -Wdeprecated-declarations in curl_arginfo.h
2023-03-22 20:58:33 +01:00
Ilija Tovilo
c8f9adb44d
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ext/curl: suppress -Wdeprecated-declarations in curl_arginfo.h
2023-03-22 20:58:25 +01:00
Max Kellermann
2646d76abc
ext/curl: suppress -Wdeprecated-declarations in curl_arginfo.h
Disable the warning before including curl_arginfo.h.

(Follow-up for https://github.com/php/php-src/pull/10531)
2023-03-22 20:57:41 +01:00
George Peter Banyard
51b70e4414
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fixed bug GH-10270 Unable to return CURL_READFUNC_PAUSE in readfunc callback
  Fix GH-10672 (pg_lo_open segfaults in the strict_types mode)
2023-02-24 14:33:47 +00:00
George Peter Banyard
512abc23a4
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed bug GH-10270 Unable to return CURL_READFUNC_PAUSE in readfunc callback
  Fix GH-10672 (pg_lo_open segfaults in the strict_types mode)
2023-02-24 14:33:28 +00:00
Pierrick Charron
91db3a1b85
Fixed bug GH-10270 Unable to return CURL_READFUNC_PAUSE in readfunc callback
Closes GH-10607

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-02-24 14:32:23 +00:00
Max Kellermann
263b22f374
Make lots of string pointers const (#10646)
This allows using string literals without implicitly casting away the
`const`.
2023-02-21 14:01:37 +00:00
George Peter Banyard
373809c51b
Merge branch 'PHP-8.2'
* PHP-8.2:
  ext/curl/interface: fix zend_result return value
  Zend/zend_ini: fix zend_result return values
2023-02-21 13:54:12 +00:00
George Peter Banyard
f6ec807871
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ext/curl/interface: fix zend_result return value
  Zend/zend_ini: fix zend_result return values
2023-02-21 13:53:48 +00:00
Max Kellermann
ed4dc39e7f
ext/curl/interface: fix zend_result return value
Closes GH-10640

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-02-21 13:41:07 +00:00
David Carlier
00ae200143 Merge branch 'PHP-8.2' 2023-02-08 18:33:51 +00:00
David Carlier
06120df71e Merge branch 'PHP-8.1' into PHP-8.2 2023-02-08 18:32:33 +00:00
Max Kellermann
8c8a38a75c ext/curl: suppress -Wdeprecated-declarations
Closes GH-10531.
2023-02-08 18:32:13 +00:00
Bob Weinand
a01dd9feda Revert "Port all internally used classes to use default_object_handlers"
This reverts commit 94ee4f9834.

The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
Bob Weinand
94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Máté Kocsis
51eb1d4f6c
Fix curl/sync_constants.php (#9391) 2022-08-21 18:04:33 +02:00
Máté Kocsis
e6e26b444d
Declare ext/curl constants in stubs (#9384) 2022-08-20 11:01:40 +02:00
Ilija Tovilo
3b92a96610
Convert return type of various object handlers from int to zend_result (#8755) 2022-06-26 01:00:19 +02:00
Pierrick Charron
b08076ef97
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fixed CURLOPT_TLSAUTH_TYPE is not treated as a string option.
2022-06-17 19:54:45 -04:00
Pierrick Charron
bb010adf29
Merge branch 'PHP-8.0' into PHP-8.1 2022-06-17 19:52:44 -04:00
Pierrick Charron
d84b972658
Fixed CURLOPT_TLSAUTH_TYPE is not treated as a string option. 2022-06-17 19:51:58 -04:00
Pierrick Charron
b9af4335e3
Add new curl_upkeep() function 2022-06-13 18:15:21 -04:00
Pierrick Charron
cec20f615d
Expose new constants from libcurl 7.62 to 7.80 2022-06-13 18:15:21 -04:00
David Carlier
10921525e6
Add CURLOPT_MAXFILESIZE_LARGE option
Like other *LARGE options, it takes a 64 bit value.

Closes GH-8557.
2022-05-16 11:01:28 +02:00
Derick Rethans
fb3cba494e Fix multi-same-name-fields in Curl for old (> 7.56.0) versions 2022-04-29 16:39:01 +01:00
David Carlier
7a45dcfe2e
Introduce CURLOPT_XFERINFOFUNCTION
`CURLOPT_XFERINFOFUNCTION` is available as of cURL 7.32.0, and
supersedes `CURLOPT_PROGRESSFUNCTION` which is still supported by
latest cURL, though.

Closes GH-7823.
2022-04-22 18:09:06 +02:00
Derick Rethans
8093ed6168 Implemented FR #51634: Can't post multiple fields with the same name
This PR allows for multiple values with the same field name to be sent to an
HTTP server. This server can't be PHP, because PHP's POST processing does not
allow for two the same field names. But sending multiple fields with the same
name is required for some operations by RFC 7578.

This PR allows you to attach an array of values to a field name, and each of
these will then be sent as its own distinct multipart/form-data field.
2022-04-07 10:01:31 +01:00
Ayesh Karunaratne
d23e36da81 Add CURLINFO_EFFECTIVE_METHOD
Since Curl 7.72.0, it supports a new parameter
called `CURLINFO_EFFECTIVE_METHOD`, which returns the effect method
in HTTP(s) requests. This is similar to `CURLINFO_EFFECTIVE_URL`.

 - https://curl.se/libcurl/c/CURLINFO_EFFECTIVE_METHOD.html

This adds support for CURLINFO_EFFECTIVE_URL if ext/curl is built
with libcurl >= 7.72.0 (0x074800).

Closes GH-7595.
2021-10-21 10:33:40 +02:00
George Peter Banyard
5ad1b89789 Use more specific types instead of int in cURL extension 2021-09-30 14:34:39 +01:00
Nikita Popov
5adfcfe746 Merge branch 'PHP-8.0'
* PHP-8.0:
  Avoid dangling pointer in curl header.str
2021-08-31 17:25:38 +02:00
Nikita Popov
db055fdb89 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Avoid dangling pointer in curl header.str
2021-08-31 17:24:30 +02:00
Alexey Zamorov
8c292a2f9d Avoid dangling pointer in curl header.str
If buf_len is zero, this would leave behind a dangling pointer
to an already released header.str. Make sure this can't happen
by always overwriting the pointer.

Closes GH-7376.
2021-08-31 17:23:58 +02:00
Nikita Popov
4ba7e5b24d Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix curl_copy_handle() with CURLINFO_HEADER_OUT
2021-08-31 17:09:34 +02:00
Nikita Popov
416dd524f9 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix curl_copy_handle() with CURLINFO_HEADER_OUT
2021-08-31 17:09:07 +02:00
Nikita Popov
30e791ed56 Fix curl_copy_handle() with CURLINFO_HEADER_OUT
The CURLOPT_DEBUGDATA will point to the old curl handle after
copying. Update it to point to the new handle.

We don't separately store whether CURLINFO_HEADER_OUT is enabled,
so I'm doing this unconditionally. It should be harmless if
CURLOPT_DEBUGFUNCTION is not used.
2021-08-31 17:06:41 +02:00
Joe Watkins
570d9b63e9
Not serializable flag permeation 2021-07-20 12:28:35 +02:00
Cameron Porter
b11785c5e4 Fixed bug #81085: Add version 7.71.0 blob options.
Adds support for the following options beginning with version 7.71.0:

    CURLOPT_ISSUERCERT_BLOB
    CURLOPT_PROXY_ISSUERCERT
    CURLOPT_PROXY_ISSUERCERT_BLOB
    CURLOPT_PROXY_SSLCERT_BLOB
    CURLOPT_PROXY_SSLKEY_BLOB
    CURLOPT_SSLCERT_BLOB
    CURLOPT_SSLKEY_BLOB

Closes GH-7194.
2021-06-28 09:54:45 +02:00