Commit Graph

57888 Commits

Author SHA1 Message Date
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
Tyson Andre
0d99628ac1 Fix edge case serializing __PHP_Incomplete_Class properties.
This was using strcmp instead of zend_string_equals_literal.
As a result, the property count didn't match the number of properties
being serialized if properties started with
"__PHP_Incomplete_Class\0" (unlikely)

(before, `'O:8:"Missing_":1:{}'` would be serialized, which failed to
unserialize)

Everywhere else expects the MAGIC_MEMBER to match exactly,
and this should use zend_string_equals_literal as an example for other code.

This has used strcmp since 2004 in deb84befae

Closes GH-6555
2021-01-04 09:46:54 -05:00
Tyson Andre
a25886d163 Optimize SplFixedArray when magic methods aren't overridden
This decreases the memory usage of SplFixedArrays by 32 bytes per object
on 64-bit systems (use 1 null pointer instead of 5 null pointers)
If allocating a lot of arrays of size 1, memory usage was 19.44MiB before this
change, and 16.24MiB after the change.

Existing tests continue to pass.

Subclassing SplFixedArray is already inefficient and rarely done.
It checks for the existence of 5 methods every time a subclass is instantiated.
(and has to switch back from C to the php vm to call those methods)

Closes GH-6552
2021-01-04 09:44:08 -05:00
Nikita Popov
7eed6c0c05 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix newly added GMP test
2021-01-04 15:27:41 +01:00
Nikita Popov
821eaaf0b4 Fix newly added GMP test 2021-01-04 15:27:20 +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
e69a65a2b5 Export php_getenv() API
This exports a php_getenv() API which will fetch an environment
variable in a thread-safe manner (assuming all other environment
manipulations are thread-safe ... ha ha ha).

Closes GH-6571.
2021-01-04 14:52:07 +01:00
George Peter Banyard
01f7722faa Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix GMP comparison object handler
2021-01-04 14:48:48 +01:00
George Peter Banyard
1b5c62facd Fix GMP comparison object handler
gmp_cmp() doesn't return false anymore in PHP 8 but will throw
an Error if compared to a non numeric string or another type of object.

Closes GH-6553
2021-01-04 14:47:50 +01:00
Nikita Popov
4b544f25ef Merge branch 'PHP-8.0'
* PHP-8.0:
  Try to fix intermittent failures of stream_server_reneg_limit.phpt on macos
2021-01-04 14:33:02 +01:00
Nikita Popov
af7445b9ac Try to fix intermittent failures of stream_server_reneg_limit.phpt on macos
Make sure the server has started up before we try to connect to it.
2021-01-04 14:31:42 +01:00
Nikita Popov
a6eb370d50 Merge branch 'PHP-8.0'
* PHP-8.0:
  Throw ValueError instead of TypeError for malformed GMP number
2021-01-04 14:30:19 +01:00
Nikita Popov
65f14b0d6c Throw ValueError instead of TypeError for malformed GMP number
If the passed argument has correct type (string) but does not
have a well-formed value, throw ValueError instead of TypeError.

Closes GH-6572.
2021-01-04 14:30:08 +01:00
zeriyoshi
53ee3f7f89 Use php_random_bytes() in mt_srand() and uniqid()
Use php_random_bytes() to generate the MT19937 seed if none is
explicitly given. Also use it to generate more_entry for uniqid().

These changes should not impact user-observable behavior apart
from result statistics.

Closes GH-6520.
2021-01-04 14:20:49 +01:00
Dharman
2f1d32d25c Avoid throwing warnings in mysqlnd
Instead report them as proper client errors.

Closes GH-6530.
2021-01-04 12:31:56 +01:00
Christoph M. Becker
9b269df6af Merge branch 'PHP-8.0'
* PHP-8.0:
  SQLite3::query() cannot return null
2021-01-04 12:16:46 +01:00
Christoph M. Becker
abe23bd9a3 SQLite3::query() cannot return null 2021-01-04 12:13:06 +01:00
Nikita Popov
f91ece0d07 Merge branch 'PHP-8.0'
* PHP-8.0:
  Mac M1 crc32 detection support
2021-01-04 11:42:17 +01:00
David CARLIER
6e90c75507 Mac M1 crc32 detection support
Closes GH-6556.
2021-01-04 11:41:52 +01:00
Stanislav Malyshev
9a3ea5ffbc Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix test name
  [ci skip] Update NEWS
  [ci skip] Update NEWS
  [ci skip] Fix order
  [ci skip] Unpdate NEWS
  Fix bug #79405 - gethostbyname() silently truncates after a null byte
  Fix #77423: parse_url() will deliver a wrong host to user
  Fix #77423: parse_url() will deliver a wrong host to user
2021-01-04 01:53:54 -08:00
Stanislav Malyshev
bf2bb39eac Fix test name 2021-01-04 01:52:59 -08:00
Stanislav Malyshev
ced4c0bfe6 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  [ci skip] Update NEWS
  [ci skip] Fix order
  [ci skip] Unpdate NEWS
  Fix #77423: parse_url() will deliver a wrong host to user
2021-01-04 01:47:09 -08:00
Nikita Popov
e54499219f Skip tests under asan
When PDO firebird is loaded and these posix tests are run with
parallelism, LeakSanitizer will occasionally segfault. I was not
able to root cause this issue, as I failed to reproduce it in
simpler circumstances. I don't think it's an issue on our side
though.
2021-01-04 10:45:49 +01:00
Stanislav Malyshev
7daf2d8602 Fix bug #79405 - gethostbyname() silently truncates after a null byte 2021-01-04 01:20:22 -08:00
Christoph M. Becker
5174de7cd3 Fix #77423: parse_url() will deliver a wrong host to user
To avoid that `parse_url()` returns an erroneous host, which would be
valid for `FILTER_VALIDATE_URL`, we make sure that only userinfo which
is valid according to RFC 3986 is treated as such.

For consistency with the existing url parsing code, we use ctype
functions, although that is not necessarily correct.
2021-01-04 01:20:21 -08:00
Stanislav Malyshev
8768621149 Fix bug #79405 - gethostbyname() silently truncates after a null byte 2021-01-04 01:19:21 -08:00
Christoph M. Becker
b132da7f9d Fix #77423: parse_url() will deliver a wrong host to user
To avoid that `parse_url()` returns an erroneous host, which would be
valid for `FILTER_VALIDATE_URL`, we make sure that only userinfo which
is valid according to RFC 3986 is treated as such.

For consistency with the existing url parsing code, we use ctype
functions, although that is not necessarily correct.
2021-01-04 01:19:18 -08:00
Remi Collet
9bf43c4590 rename COMPILER and ARCHITECTURE macro (too generic) 2021-01-04 10:13:54 +01:00
Christoph M. Becker
b30462bead Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix imap stubs
2021-01-03 16:20:01 +01:00
Christoph M. Becker
aab23282fc Fix imap stubs
Closes GH-6559.
2021-01-03 16:15:46 +01:00
Christoph M. Becker
533af1eb14 Merge branch 'PHP-8.0'
* PHP-8.0:
  ZipArchive methods do not return NULL
2021-01-03 16:12:24 +01:00
Christoph M. Becker
e470f9b389 ZipArchive methods do not return NULL
Closes GH-6563.
2021-01-03 16:12:10 +01:00
Tyson Andre
dfb9e03336 Use Z_PARAM_OBJ macros when zval isn't needed
In some cases, like spl_object_id, the code is simpler but equally efficient
after optimizations.

In other cases, like get_mangled_object_vars(), the compiler can't infer that
the object in the zval won't change.

Closes GH-6567
2021-01-02 16:10:14 -05:00
Stanislav Malyshev
434c2b1bdb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #77423: parse_url() will deliver a wrong host to user
2021-01-01 21:29:08 -08:00
Stanislav Malyshev
128fca4037 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77423: parse_url() will deliver a wrong host to user
2021-01-01 21:06:07 -08:00
Christoph M. Becker
2d3d72412a Fix #77423: parse_url() will deliver a wrong host to user
To avoid that `parse_url()` returns an erroneous host, which would be
valid for `FILTER_VALIDATE_URL`, we make sure that only userinfo which
is valid according to RFC 3986 is treated as such.

For consistency with the existing url parsing code, we use ctype
functions, although that is not necessarily correct.
2021-01-01 20:08:01 -08:00
Christoph M. Becker
64c753e7c8 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix parameter name
2021-01-01 23:05:09 +01:00
Christoph M. Becker
cae0bcbab5 Fix parameter name
Levenshtein is about insertion, replacement and deletion.

Closes GH-6560.
2021-01-01 23:04:28 +01:00
Christoph M. Becker
d017b3e1a0 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix build
2021-01-01 17:42:27 +01:00
Christoph M. Becker
b2fba0ef62 Fix build
We cannot `RETURN_THROWS()` here, since `return_value` is not defined.
2021-01-01 17:41:48 +01:00
Máté Kocsis
6f954cc119
Merge branch 'PHP-8.0' 2021-01-01 16:53:16 +01:00
Máté Kocsis
b23c865d15
Use RETURN_THROWS() in a few places 2021-01-01 16:52:48 +01:00
Christoph M. Becker
e8e0d52d36 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix ReflectionClass::getConstants() stub
2021-01-01 14:47:10 +01:00
Christoph M. Becker
82f9e004da Fix ReflectionClass::getConstants() stub
If `zval_update_constant_ex()` fails, an exception has already been
thrown, so we clarify that in the implementation as well.

Closes GH-6557.
2021-01-01 14:46:28 +01:00
Christoph M. Becker
35333bd1c6 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80560: Strings containing only a base prefix return 0 object
2020-12-30 12:50:39 +01:00
George Peter Banyard
abecaab09f Fix #80560: Strings containing only a base prefix return 0 object
Closes GH-6549.
2020-12-30 12:50:04 +01:00
George Peter Banyard
6c3b69bd7b Remove superfluous return statement. 2020-12-29 16:55:19 +01:00
Tyson Andre
f29dcc168a Remove redundant check in SplObjectStorage->count 2020-12-29 10:16:21 -05:00
Dmitry Stogov
984df80e27 Merge branch 'PHP-8.0'
* PHP-8.0:
  Initialize EX(call)->func by single instruction
  Reuse value stored in %r0 instead of immediate operand
2020-12-29 13:21:06 +03:00