Commit Graph

1100 Commits

Author SHA1 Message Date
Fabien Villepinte
0aa3acc6c4 Fix borked SKIPIFs 2019-09-30 17:51:41 +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
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
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
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
17f7fb7605 Switch to using shell-less proc_open() in various server tests 2019-07-11 15:48:10 +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
8757f30cc7 Fix CURLINFO_COOKIELIST leak 2019-06-25 14:28:58 +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
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
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
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
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
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
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
GITSRC
5d3337076b Require semicolon after SAVE_CURL_ERROR() 2019-05-13 11:01:37 +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
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
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
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
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
c68dc6b5e3 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>
2019-04-29 10:21:07 +02:00
Dmitry Stogov
e188e4170f Use ZEND_TRY_ASSIGN_REF_... macros for arguments passed to internal function by reference 2019-04-24 18:28:29 +03:00
Christoph M. Becker
a83b68ba56 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.
2019-04-16 08:43:21 +02:00
Rodrigo Prado
8e68a9d9eb Add test for curl_version() 2019-04-15 15:57:11 +02:00
Nikita Popov
3e0f9c2c94 Remove curl gnutls locking
This is only relevant for the gcrypt backend, which is no longer in
use. I couldn't find any hard info on when exactly gcrypt support was
dropped, but nette is the default since 2.11.1. Most code that still
has the gcrypt handling is checking against < 2.12. In either case,
those versions were released in 2010/2011.
2019-04-11 16:45:45 +02:00
Nikita Popov
539a16fdb8 Avoid curl ssl callback warnings with OpenSSL 1.1 2019-04-11 14:14:21 +02:00
Fabien Villepinte
26dfce7f36 Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
Pedro Magalhães
63802a8446 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Added test for #77535 fix
2019-03-15 18:13:37 +00:00
Pedro Magalhães
3a04b507ec Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Added test for #77535 fix
2019-03-15 18:12:55 +00:00
Pedro Magalhães
f167b06d4c Added test for #77535 fix 2019-03-15 18:11:51 +00:00
Nikita Popov
585f4cbb21 Merge branch 'PHP-7.3' into PHP-7.4 2019-03-15 17:08:01 +01:00
Nikita Popov
7899f6a906 Merge branch 'PHP-7.2' into PHP-7.3 2019-03-15 17:07:48 +01:00
Nikita Popov
97f9fd6949 Don't immediately destroy curl pushfunction 2019-03-15 17:07:19 +01:00
Daniel Stenberg
d9d253fa6b curl_exec: remove bad check for CURLE_PARTIAL_FILE
This check introduced in 2004 is wrong and removed. A HEAD request with
curl does *not* cause this error code - only if you make a regular GET
request but tell curl to send a HEAD using CURLOPT_CUSTOMREQUEST and
then you've asked for it.

You do a proper HEAD request with curl by setting the CURLOPT_NOBODY
option to 1L.

This was the case in 2004. This is still the case in 2019. This is also
documented in libcurl documentation.

This check hides the possibly serious error when this error code is
genuinely and correctly returned by curl because the transfer was
truncated and ended up partial.

As can be seen, I objected to this change already in the original bug:
https://bugs.php.net/bug.php?id=27341
2019-03-11 09:56:25 +01:00
Peter Kokot
9df6a1e4dd Add AS_HELP_STRING to *nix build configure options
The Autoconf's default AS_HELP_STRING macro can properly format help
strings [1] so watching out if columns are aligned manually is not
anymore.

[1] https://www.gnu.org/software/autoconf/manual/autoconf.html#Pretty-Help-Strings
2019-03-07 20:36:59 +01:00
Nikita Popov
c8e10c6119 More zpp error/variation test removals 2019-03-07 15:54:31 +01:00
Nikita Popov
6878d1026b Merge branch 'PHP-7.3' into PHP-7.4 2019-03-01 14:55:24 +01:00
Nikita Popov
8be12e770f Merge branch 'PHP-7.2' into PHP-7.3 2019-03-01 14:55:15 +01:00
Jay Satiro
5025eb05bd curl_error: return an empty string if no error occurred
CURLOPT_ERRORBUFFER doc says "Do not rely on the contents of the
buffer unless an error code was returned." [1]

Prior to this change the error buffer was returned even if no error had
occurred, and that buffer may contain incorrect information in such a
case. [2]

[1]: https://curl.haxx.se/libcurl/c/CURLOPT_ERRORBUFFER.html
[2]: https://github.com/curl/curl/issues/3629
2019-03-01 14:54:37 +01:00
Nikita Popov
c0e15a3b7f Implement fine-grained conflict handling
Tests can specify conflict keys, either in --CONFLICTS-- or
a per-directory CONFLICTS file. Non-conflicting tests may be run
in parallel.
2019-02-20 11:20:40 +01:00