Commit Graph

146 Commits

Author SHA1 Message Date
Joe Watkins
570d9b63e9
Not serializable flag permeation 2021-07-20 12:28:35 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Nikita Popov
ce0bc58c22 Merge branch 'PHP-8.0'
* PHP-8.0:
  Mark resource-like objects as non-comparable
2021-02-16 14:22:03 +01:00
Nikita Popov
b63ea1047a Mark resource-like objects as non-comparable
As these hold on to some internal resource, there can't be two
"equal" objects with different identity. Make sure the lack of
public properties doesn't result in these being treated as always
equal.
2021-02-16 14:20:45 +01:00
Máté Kocsis
5f21062054
Generate class entries for a few extensions
Relates to GH-6644
2021-02-03 09:24:09 +01:00
Nikita Popov
5c21d39d55 Remove method member from php_curl_callback
For these callbacks a non-null callback already indicates that
a user callback should be used. We don't need an additional
member to tell us the same thing.
2021-01-04 16:24:20 +01:00
Nikita Popov
ce2e1076d4 Don't allocate php_curl_handlers separately
Always allocated together with php_curl... no point in that.
2021-01-04 15:59:18 +01:00
Nikita Popov
cc11130b38 Don't allocate php_curlm_handlers separately
This is always allocated together with the php_curlm structure,
there's no point in making it a separate allocation.
2021-01-04 15:59:18 +01:00
Nikita Popov
66ffa1c9d2 Use single typedef for curl callbacks
There's no value in making these separate types.
2021-01-04 15:19:01 +01:00
Nikita Popov
d96219c185 Fixed bug #80121
The issue affected both CurlHandle and CurlMultiHandle. I'll have
to double check this for other resource->object conversions as well.
2020-10-01 17:05:23 +02:00
Nikita Popov
85b5dc4711 Private/public split curl header
To allow exporting the php_curl.h header containing curl class
entries, split off a separate curl_private.h header with all the
implementation details.

We may move or expose additional APIs in php_curl.h on an as-needed
basis.
2020-09-07 11:12:41 +02:00
Nikita Popov
d1ac7e3ab1 Remove some unnecessary HAVE_EXTNAME guards
A recurring pattern in old extension: Putting the whole source
code behind HAVE_EXTNAME. This is pointless, as the code is only
compiled if the extension is enabled.

This removes a couple of them, but not all.
2020-09-07 11:05:07 +02:00
Máté Kocsis
517c9938af
Promote warnings to exceptions in ext/curl
Closes GH-5963
2020-08-14 17:40:35 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov
653e4ea1c5 Add flag to forbid dynamic property creation on internal classes
While performing resource -> object migrations, we're adding
defensive classes that are final, non-serializable and non-clonable
(unless they are, of course). This path adds a ZEND_ACC_NO_DYNAMIC_PROPERTIES
flag, that also forbids the creation of dynamic properties on these objects.
This is a subset of #3931 and targeted at internal usage only
(though may be extended to userland at some point in the future).

It's already possible to achieve this (what the removed
WeakRef/WeakMap code does), but there's some caveats: First, this
simple approach is only possible if the class has no declared
properties, otherwise it's necessary to special-case those
properties. Second, it's easy to make it overly strict, e.g. by
forbidding isset($obj->prop) as well. And finally, it requires a
lot of boilerplate code for each class.

Closes GH-5572.
2020-06-24 11:52:36 +02:00
Nikita Popov
26171c3690 Also allow casting CurlMultiHandles 2020-06-22 15:09:22 +02:00
Máté Kocsis
b516566b84
Convert CURL resources to objects
Closes GH-5402

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-06-17 16:11:57 +02:00
George Peter Banyard
93b51f4e26 Fix [-Wundef] warning in cURL extension 2020-05-16 15:31:13 +02: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
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
Máté Kocsis
bbcfa66e06
Use RETURN_THROWS() after zend_fetch_resource*() 2020-01-03 19:20:56 +01:00
Máté Kocsis
9493893412 Cleanup return values when parameter parsing is unsuccessful 2019-10-30 16:05:20 +01:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +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
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
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
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
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
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
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Zeev Suraski
0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Nikita Popov
6beecbb0aa Merge branch 'PHP-7.3' 2019-01-18 12:06:42 +01:00
Nikita Popov
de38ce1a2e Merge branch 'PHP-7.2' into PHP-7.3 2019-01-18 12:05:11 +01:00
Pedro Magalhães
32ae716037 Fixed bug #76675
Leave a reference to the resource in the php_curl.
2019-01-18 12:04:25 +01:00
Nikita Popov
e219ec144e Implement typed properties
RFC: https://wiki.php.net/rfc/typed_properties_v2

This is a squash of PR #3734, which is a squash of PR #3313.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Joe Watkins <krakjoe@php.net>
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2019-01-11 15:49:06 +01:00
Gabriel Caruso
cdd8368d6f Clean up unnecessary ternary expressions and simplify some returns
- Simplify conditions
- Use ZEND_HASH_APPLY_* instead of hard-coded booleans
- Use ZEND_NORMALIZE_BOOL
- Drop sign in favor of ZEND_NORMALIZE_BOOL
2018-12-03 01:22:14 +01:00
Pierrick Charron
aec2d63124 Merge branch 'PHP-7.2' into PHP-7.3 2018-09-17 20:31:07 -04:00
Pierrick Charron
bc1ecd5d7f Merge branch 'PHP-7.1' into PHP-7.2 2018-09-17 20:30:18 -04:00
Pierrick Charron
3bb218a0a7 Fix 76480: Use curl_multi_wait() so that timeouts are respected 2018-09-17 20:28:44 -04:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00