Commit Graph

1230 Commits

Author SHA1 Message Date
ekinhbayar
8ceac81b45 Remove CURLOPT_PASSWDDATA block CURLOPT_PASSWDDATA was removed from curl as of 7.10.8
Closes GH-5166.
2020-02-11 12:04:24 +01:00
Christoph M. Becker
f55f0ae978 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79019: Copied cURL handles upload empty file
2020-02-04 11:30:57 +01:00
Christoph M. Becker
2d0dec91a5 Fix #79019: Copied cURL handles upload empty file
To cater to `curl_copy_handle()` of cURL handles with attached
`CURLFile`s, we must not attach the opened stream, because the stream
may not be seekable, so that we could rewind, when the same stream is
going to be uploaded multiple times.  Instead, we're opening the stream
lazily in the read callback.

Since `curl_multi_perfom()` processes easy handles asynchronously, we
have no control of the operation sequence.  Since duplicated cURL
handles may be used with multi handles, we cannot use a single arg
structure, but actually have to rebuild the whole mime structure on
handle duplication and attach this to the new handle.

In order to better test this behavior, we extend the test responder to
print the size of the upload, and patch the existing tests accordingly.
2020-02-04 11:09:28 +01:00
Christoph M. Becker
fabe6aa7dc Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78090: bug45161.phpt takes forever to finish
2020-02-04 00:54:54 +01:00
Christoph M. Becker
a0c93bf65e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78090: bug45161.phpt takes forever to finish
2020-02-04 00:45:54 +01:00
Christoph M. Becker
079905acd5 Fix #78090: bug45161.phpt takes forever to finish
Not all systems support the discard protocol (TCP port 9), and since
there is no particular reason to use it, we switch to using actual
server testing.
2020-02-04 00:44:04 +01:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Christoph M. Becker
2fe86669c9 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add CURLOPT CURLOPT_HTTP09_ALLOWED available since 7.64.0
2020-01-26 14:14:52 +01:00
Christoph M. Becker
41e1891e0c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add CURLOPT CURLOPT_HTTP09_ALLOWED available since 7.64.0
2020-01-26 14:13:52 +01:00
Florian Smeets
b836d9cdc1 Add CURLOPT CURLOPT_HTTP09_ALLOWED available since 7.64.0 2020-01-26 14:12:53 +01:00
Christoph M. Becker
7426e3b6a1 Bump required libcurl version to 7.29.0
libcurl 7.29.0 has been released almost eight years ago, so this
version is supposed to be available practically everywhere.  This bump
also allows us to get rid of quite some conditional code and tests
catering to very old libcurl versions.
2020-01-19 14:10:46 +01:00
Máté Kocsis
d1764ca330
Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Máté Kocsis
afdaa91170
Fix #78880: Final spelling fixes 2020-01-16 19:14:31 +01:00
Christoph M. Becker
3c6a230b71 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79078: Hypothetical use-after-free in curl_multi_add_handle()
2020-01-08 18:43:35 +01:00
Christoph M. Becker
b2864b7cfd Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79078: Hypothetical use-after-free in curl_multi_add_handle()
2020-01-08 18:31:38 +01:00
Christoph M. Becker
0dda4a844e Fix #79078: Hypothetical use-after-free in curl_multi_add_handle()
To avoid this, we have to verify the handlers already in
`curl_multi_add_handle()`, not only in `curl_multi_exec()`.
2020-01-08 18:29:10 +01:00
Christoph M. Becker
8f185d3586 Merge branch 'PHP-7.4'
* PHP-7.4:
  Extract function
2020-01-08 16:56:28 +01:00
Christoph M. Becker
a6d385a8e8 Extract function
As suggested by Nikita[1].

[1] <https://github.com/php/php-src/pull/5045#discussion_r364265013>
2020-01-08 16:55:13 +01:00
Christoph M. Becker
b8609e2fa7 Merge branch 'PHP-7.4'
* PHP-7.4:
  Make test more resilient
2020-01-07 15:29:51 +01:00
Christoph M. Becker
eaa93f6b8a Make test more resilient
Depending on the libcurl version and perhaps configuration, it may show
additional info (due to `CURLOPT_VERBOSE` being activated), which we
have to ignore, to avoid spurious test failures.
2020-01-07 15:28:48 +01:00
Christoph M. Becker
06e78cad83 Revert "Extend CURLFile to support streams"
This reverts commit 17a9f1401a, because
this commit would break ABI, and also due to bug #79013.
We keep the commit for PHP 7.4+, though.
2020-01-06 15:31:49 +01:00
Nikita Popov
0b4da7e6da Merge branch 'PHP-7.4'
* PHP-7.4:
  Don't link against openssl 1.1 in curl
2020-01-06 10:43:05 +01:00
Nikita Popov
68f6ab7113 Don't link against openssl 1.1 in curl
OpenSSL 1.1 does not need crypto locking callbacks, so avoid
detecting and linking against it in the first place.
2020-01-06 10:42:57 +01:00
Nikita Popov
730f4f25db Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #79063: Curl openssl does not respect PKG_CONFIG_PATH
  Clean up curl openssl check
2020-01-06 10:31:34 +01:00
Nikita Popov
b59f760472 Fix bug #79063: Curl openssl does not respect PKG_CONFIG_PATH 2020-01-06 10:31:22 +01:00
Nikita Popov
2d29904f25 Clean up curl openssl check
Only set HAVE_CURL_OPENSSL flag, and remove Windows specific code,
as all of this is only relevant for OpenSSL < 1.1, which is not
used on Windows.
2020-01-06 10:17:37 +01:00
Máté Kocsis
bbcfa66e06
Use RETURN_THROWS() after zend_fetch_resource*() 2020-01-03 19:20:56 +01:00
Christoph M. Becker
e1559b51cd Merge branch 'PHP-7.4'
* PHP-7.4:
  Add missing skipif clause
2019-12-28 11:02:03 +01:00
Christoph M. Becker
935a61d034 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add missing skipif clause
2019-12-28 11:01:22 +01:00
Christoph M. Becker
1aa419dcdc Add missing skipif clause 2019-12-28 11:00:37 +01:00
Christoph M. Becker
86675dd3f9 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79033: Curl timeout error with specific url and post
2019-12-28 10:49:56 +01:00
Christoph M. Becker
6d1dff6f3d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79033: Curl timeout error with specific url and post
2019-12-28 10:48:59 +01:00
Christoph M. Becker
c47b18a222 Fix #79033: Curl timeout error with specific url and post
We must not set an empty mime structure as `CURLOPT_MIMEPOST`; instead
we set it to `NULL` if `CURLOPT_POSTFIELDS` has been set to an empty
array.
2019-12-28 10:47:03 +01:00
Christoph M. Becker
17a9f1401a Extend CURLFile to support streams
Due to former restrictions of the libcurl API, curl multipart/formdata
file uploads supported only proper files.  However, as of curl 7.56.0
the new `curl_mime_*()` API is available (and already supported by
PHP[1]), which allows us to support arbitrary *seekable* streams, which
is generally desirable, and particularly resolves issues with the
transparent Unicode and long part support on Windows (see bug #77711).

Note that older curl versions are still supported, but CURLFile is
still restricted to proper files in this case.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=a83b68ba56714bfa06737a61af795460caa4a105>

(cherry picked from commit c68dc6b5e3)
2019-12-09 10:30:00 +01:00
Christoph M. Becker
e1202733a5 Use curl_mime_*() functions if available
As of curl 7.56.0, `curl_formadd()` is deprecated in favor of
`curl_mime_*()`, so we use the latter if available.

(cherry picked from commit a83b68ba56)
2019-12-09 10:24:49 +01:00
Máté Kocsis
c58b12334d Add union return types with one class 2019-11-18 12:44:38 +01:00
Máté Kocsis
27e83d0fb8
Add union return types for function stubs 2019-11-11 14:54:55 +01:00
Fabien Villepinte
a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00
Nikita Popov
c849438bd0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #78775
2019-11-05 12:16:17 +01:00
Nikita Popov
3e41ade638 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78775
2019-11-05 12:16:09 +01:00
Nikita Popov
747cb46244 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #78775
2019-11-05 12:15:44 +01:00
Nikita Popov
4f984a2fdb Fixed bug #78775
Clear the OpenSSL error queue before performing SSL stream operations.
As we don't control all code that could possibly be using OpenSSL,
we can't rely on the error queue being empty.
2019-11-05 12:13:46 +01:00
Máté Kocsis
9493893412 Cleanup return values when parameter parsing is unsuccessful 2019-10-30 16:05:20 +01:00
Christoph M. Becker
913a449b27 Remove generic type annotations
Cf. <de69a9d3eb (r35675846)>.
2019-10-26 16:24:53 +02:00
Nikita Popov
235983dfde Merge branch 'PHP-7.4' 2019-09-30 17:52:39 +02:00
Fabien Villepinte
0aa3acc6c4 Fix borked SKIPIFs 2019-09-30 17:51:41 +02:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Simon Podlipsky
4867864cae Add Curl ext PHP stubs
Closes GH-4557.
2019-08-20 15:16:57 +02:00
Nikita Popov
429378d78d Remove some misleading RETURN_FALSE
These functions throw, so they can't return false.

This is just a subset...
2019-08-12 10:05:36 +02:00
Nikita Popov
a1e2c8870e Merge branch 'PHP-7.4' 2019-07-22 17:26:01 +02:00
Nikita Popov
d59aac58b3 Report errors from stream read and write operations
The php_stream_read() and php_stream_write() functions now return
an ssize_t value, with negative results indicating failure. Functions
like fread() and fwrite() will return false in that case.

As a special case, EWOULDBLOCK and EAGAIN on non-blocking streams
should not be regarded as error conditions, and be reported as
successful zero-length reads/writes instead. The handling of EINTR
remains unclear and is internally inconsistent (e.g. some code-paths
will automatically retry on EINTR, while some won't).

I'm landing this now to make sure the stream wrapper ops API changes
make it into 7.4 -- however, if the user-facing changes turn out to
be problematic we have the option of clamping negative returns to
zero in php_stream_read() and php_stream_write() to restore the
old behavior in a relatively non-intrusive manner.
2019-07-22 17:17:28 +02:00
Nikita Popov
e13981f981 Merge branch 'PHP-7.4' 2019-07-18 14:42:34 +02:00
Nikita Popov
be7f405f6b Merge branch 'PHP-7.3' into PHP-7.4 2019-07-18 14:42:20 +02:00
Nikita Popov
4a9f78f9d7 Merge branch 'PHP-7.2' into PHP-7.3 2019-07-18 14:41:35 +02:00
Abyr Valg
c8c183eb62 Fixed bug #77946
Save multi_info_read() result into easy handle.
2019-07-18 14:40:47 +02:00
Peter Kokot
22583b20bc Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix typo
  Remove unused defines
2019-07-18 02:23:46 +02:00
Peter Kokot
359a78b16c Remove unused defines
Used in php-src the past and today removed and not used anymore:
- HAVE_CURL_EASY_STRERROR
- HAVE_CURL_MULTI_STRERROR
- HAVE_NEW_MIME2TEXT
- HAVE_MBSTR_CN
- HAVE_MBSTR_JA
- HAVE_MBSTR_KR
- HAVE_MBSTR_RU
- HAVE_MBSTR_TW

Part of oniguruma which doesn't use these anymore
- NOT_RUBY
- HAVE_STDARG_PROTOTYPES

Unused:
- HAVE_MPIR

Closes GH-4427
2019-07-18 02:21:39 +02:00
Peter Kokot
e504716320 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove duplicate AC_PROG_CPP call
2019-07-18 02:15:32 +02:00
Peter Kokot
daa243d1a0 Remove duplicate AC_PROG_CPP call
AC_PROG_CPP is already called in configure.ac.

Closes GH-4425
2019-07-18 02:14:31 +02:00
Nikita Popov
74bf7bfb88 Merge branch 'PHP-7.4' 2019-07-11 15:49:02 +02:00
Nikita Popov
17f7fb7605 Switch to using shell-less proc_open() in various server tests 2019-07-11 15:48:10 +02:00
Nikita Popov
f6f0d383b3 Merge branch 'PHP-7.4' 2019-07-03 11:42:04 +02:00
Nikita Popov
959c84b249 Remove curl_basic_017.phpt
The output of the three handles may be interleaved. We already have
curl_basic_018.phpt which uses curl_multi_getcontent() and thus
has predictable output. As such, I'm dropping this test altogether.
2019-07-03 11:38:24 +02:00
Nikita Popov
a1479fbbd9 Merge branch 'PHP-7.4' 2019-06-25 14:30:24 +02:00
Nikita Popov
8757f30cc7 Fix CURLINFO_COOKIELIST leak 2019-06-25 14:28:58 +02:00
Nikita Popov
dc18af96f9 Merge branch 'PHP-7.4' 2019-06-17 12:44:42 +02:00
Nikita Popov
6381b1ee82 Make ext/curl/tests/bug48203_multi.phpt more robust
We don't have a guarantee in which order the output here will
occur. And it's not really relevant for the test anyway, so use a
wildcard.
2019-06-17 12:43:45 +02:00
Nikita Popov
98f81ace40 Merge branch 'PHP-7.4' 2019-06-14 16:56:42 +02:00
Nikita Popov
8a5ce6f16f Make curl_multi_info_read.phpt more robust
I don't think there's any need to make remote connections here
(and bugs.php.net is down right now...) so just use local files
instead.
2019-06-14 16:55:51 +02:00
Nikita Popov
5ae158a004 Merge branch 'PHP-7.4' 2019-06-12 15:28:41 +02:00
Nikita Popov
bc8fece0cf Don't warn if libcurl SSL library not detected
libcurl may link against 7 different ssl libraries, all of which
are thread-safe -- apart from openssl, of course. We check for
openssl and register locking callbacks in that case, but we should
not warn if any other library is used.
2019-06-12 15:26:50 +02:00
Nikita Popov
477d1e02ae Merge branch 'PHP-7.4' 2019-06-12 11:54:21 +02:00
Nikita Popov
2f1d822d78 Preserve CFLAGS/LDFLAGS for curl ssl check
We need to add the curl-specific flags, but we also need to preserve
the general flags, to keep around important stuff like -m32.
2019-06-12 11:54:13 +02:00
Christoph M. Becker
1fcfb636f3 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix test regarding Unix Domain Sockets on Windows
2019-06-06 15:09:57 +02:00
Christoph M. Becker
c358c280df Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix test regarding Unix Domain Sockets on Windows
2019-06-06 15:02:41 +02:00
Christoph M. Becker
5f2f6180b9 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix test regarding Unix Domain Sockets on Windows
2019-06-06 15:00:35 +02:00
Christoph M. Becker
2df32942d3 Fix test regarding Unix Domain Sockets on Windows
Recent Windows versions actually support Unix Domain Sockets.  Cf.
<https://github.com/curl/curl/pull/3939>.
2019-06-06 14:59:58 +02:00
Nikita Popov
1df8175b61 Convert fetch_resource warnings into TypeErrors
More type checks that are not part of zpp and should generate a
TypeError in PHP 8.
2019-06-03 09:17:12 +02:00
Christoph M. Becker
5193e5c405 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix test case for cURL 7.65.0
2019-05-22 12:03:10 +02:00
Christoph M. Becker
21bf9b0f4c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix test case for cURL 7.65.0
2019-05-22 12:02:43 +02:00
Christoph M. Becker
69c634a56d Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix test case for cURL 7.65.0
2019-05-22 12:02:03 +02:00
Christoph M. Becker
62fe6ba20c Fix test case for cURL 7.65.0
Reported and patch provided by @Jan-E.
2019-05-22 12:01:23 +02:00
Rasmus Lerdorf
3345d71109 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix precedence issue causing sub-second timeouts to be 0 in curl_multi_select
2019-05-21 14:47:28 -07:00
Rasmus Lerdorf
12c1d7419a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix precedence issue causing sub-second timeouts to be 0 in curl_multi_select
2019-05-21 14:46:44 -07:00
Rasmus Lerdorf
2d29263a9f Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix precedence issue causing sub-second timeouts to be 0 in curl_multi_select
2019-05-21 14:46:24 -07:00
Rasmus Lerdorf
7b42cdf95e Fix precedence issue causing sub-second timeouts to be 0 in
curl_multi_select
2019-05-21 14:44:11 -07:00
Nikita Popov
451eb4464a Merge branch 'PHP-7.4' 2019-05-13 11:06:44 +02:00
GITSRC
5d3337076b Require semicolon after SAVE_CURL_ERROR() 2019-05-13 11:01:37 +02:00
Christoph M. Becker
248a8987ea Merge branch 'PHP-7.4'
* PHP-7.4:
  Deprecate and ignore $version parameter of curl_version()
2019-05-13 08:54:22 +02:00
Christoph M. Becker
357da6bc59 Deprecate and ignore $version parameter of curl_version()
`curl_version()`[1] (of ext/curl) makes `curl_version_info()`[2] (of
libcurl) available to PHP userland.  The latter requires to pass an
`age` argument which usually is `CURLVERSION_NOW`, so that the
information returned by the runtime matches the declarations used
during compile time.  For C programs it is simply necessary to pass
this information, and in rare occasions it might make sense to pass
something else than `CURLVERSION_NOW`.  curl.h notes:

| The 'CURLVERSION_NOW' is the symbolic name meant to be used by
| basically all programs ever that want to get version information.

For the PHP binding, using a newer `age` than available at compile time
will neither provide the PHP program more information, nor would using
an older `age` have tangible benefits.

We therefore deprecate the useless `$version` parameter, and if it is
passed nonetheless, we use `CURLVERSION_NOW` instead of the supplied
value, and raise a warning.

[1] <https://www.php.net/manual/en/function.curl-version.php>
[2] <https://curl.haxx.se/libcurl/c/curl_version_info.html>
2019-05-13 08:53:41 +02:00
Peter Kokot
2cf90bb2f0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Normalize comments in *nix build system m4 files
2019-05-12 18:51:50 +02:00
Peter Kokot
75fb74860d Normalize comments in *nix build system m4 files
Normalization include:
- Use dnl for everything that can be ommitted when configure is built in
  favor of the shell comment character # which is visible in the output.
- Line length normalized to 80 columns
- Dots for most of the one line sentences
- Macro definitions include similar pattern header comments now
2019-05-12 18:43:03 +02:00
Christoph M. Becker
7647f5401c Merge branch 'PHP-7.4'
* PHP-7.4:
  Deprecate CURLPIPE_HTTP1
2019-05-07 17:05:51 +02:00
Christoph M. Becker
72e1da81b6 Deprecate CURLPIPE_HTTP1
`CURLPIPE_HTTP1` is deprecated and has no effect as of cURL 7.62.0[1].
We therefore deprecate the PHP constant as well, and trigger a warning
that it is no longer supported, if used against cURL 7.62.0 and up.

[1] <https://curl.haxx.se/libcurl/c/CURLMOPT_PIPELINING.html>
2019-05-07 17:05:07 +02:00
Christoph M. Becker
90c6a6a939 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix comment
2019-05-03 16:51:14 +02:00
Christoph M. Becker
508892e266 Fix comment
0x2d == 45, not 46.  However, `CURLMOPT_PUSHFUNCTION` is actually
available as of cURL 7.44.0[1], while we make the respective PHP
constants available only as of cURL 7.46.0[2].

[1] <https://curl.haxx.se/libcurl/c/CURLMOPT_PUSHFUNCTION.html>
[2] <http://git.php.net/?p=php-src.git;a=blob;f=ext/curl/interface.c;h=fdf855278eef6f32f26c49b54f56aca9bd7007c3;hb=HEAD#l1289>
2019-05-03 16:50:56 +02:00
Nikita Popov
f89adfe72c Merge branch 'PHP-7.4' 2019-05-02 15:13:30 +02:00
Nikita Popov
2934f9da4d Merge branch 'PHP-7.3' into PHP-7.4 2019-05-02 15:13:24 +02:00
Javier Spagnoletti
6b73e692c9 Add more missing CURL_VERSION_* constants
And also check for CURL_VERSION_* constants in the sync-constants.php
script.

Related to request #72189: Add missing `CURL_VERSION_*` constants.
2019-05-02 15:11:42 +02:00
Christoph M. Becker
d09d3e28df Merge branch 'PHP-7.4'
* PHP-7.4:
  Extend CURLFile to support streams
2019-04-29 10:21:44 +02:00