Commit Graph

14219 Commits

Author SHA1 Message Date
Bob Weinand
0e31e03bc5 Merge branch 'PHP-8.1' into PHP-8.2 2023-02-13 13:10:08 +01:00
Arnaud Le Blanc
d721dcc2ef Fix colletion of unfinished function call in fibers
Fixes GH-10496.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
2023-02-13 13:09:04 +01:00
Arnaud Le Blanc
4d0ce3a7e5 [ci skip] NEWS 2023-02-11 16:28:51 +01:00
Niels Dossche
3af33a3e20
[ci skip] NEWS (#10561) 2023-02-10 23:18:50 +00:00
George Peter Banyard
d8cec14c11
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix memory leaks in ext-tidy
2023-02-10 14:16:38 +00:00
George Peter Banyard
704aadd098
Fix memory leaks in ext-tidy
We must not instantiate the object prior checking error conditions
Moreover, we need to release the HUGE amount of memory for files which are over 4GB when throwing a ValueError

Closes GH-10545
2023-02-10 14:12:23 +00:00
Arnaud Le Blanc
f1694409cc [ci skip] NEWS 2023-02-10 13:11:03 +01: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
Ilija Tovilo
972a5a02bd
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10168: heap-buffer-overflow at zval_undefined_cv
2023-02-08 01:12:03 +01:00
Niels Dossche
71ddede565
Fix GH-10168: heap-buffer-overflow at zval_undefined_cv
The problem is that we're using the variable_ptr in the opcode handler
*after* it has already been destroyed. The solution is to create a
specialised version of zend_assign_to_variable which takes in two
destination zval pointers.

Closes GH-10524
2023-02-08 01:06:50 +01:00
Ben Ramsey
26e10258ce
Merge branch 'PHP-8.1' into PHP-8.2 2023-02-07 09:29:39 -06:00
Ben Ramsey
ba282f1b2f
Update NEWS 2023-02-07 09:28:50 -06:00
David Carlier
c6f0e89f16 Merge branch 'PHP-8.1' into PHP-8.2 2023-02-05 16:41:34 +00:00
Niels Dossche
49551d7c29 Sync boost/context assembly files for fibers
Fixes GH-10398

The stack was misaligned upon entering the trampoline function [1], this
causes a CPU trap when the SSE instruction is executed to copy data from
the stack. This was fixed upstream [2]. This commit syncs all upstream
changes from the boost/context assembly files to our copy.

[1] https://github.com/php/php-src/pull/10407#issuecomment-1404180877
[2] https://github.com/boostorg/context/pull/219

Closes GH-10407.
2023-02-05 16:40:54 +00:00
Jakub Zelenka
2b71fa6952
Merge branch 'PHP-8.1' into PHP-8.2 2023-02-05 13:10:19 +00:00
Niels Dossche
5b13e83074
Fix GH-10385: FPM successful config test early exit
This introduces an enum `fpm_init_return_status` to propagate the status
up to fpm_main. This also makes the code clearer by not using magic
integer return numbers.

Closes GH-10388
2023-02-05 13:07:29 +00:00
Jakub Zelenka
aa9b5ed1e4
Merge branch 'PHP-8.1' into PHP-8.2 2023-02-05 12:37:40 +00:00
Jakub Zelenka
4199b72c50
Fix GH-10315: FPM unknown child alert not valid
This changes the log level for an unknown child during wait as this is
not unuasual if FPM master has pid 1 and also possible in some cases
for higher pid processes. Based on that and the fact that this is not
really a problem, there is just a debug level message emitted for pid 1
and for higher pid a warning is emitted.

Closes GH-10319
2023-02-05 12:36:02 +00:00
Tyson Andre
e3f04ddb0b Merge branch 'PHP-8.1' into PHP-8.2 2023-02-03 09:18:03 -05:00
Tyson Andre
fe2dc2b481
Avoid crash for reset/end/next/prev() on ffi classes (#9711)
(And any PECLs returning `zend_empty_array` in the handler->get_properties
overrides)

Closes GH-9697

This is similar to the fix used in d9651a9419
for array_walk.

This should make it safer for php-src (and PECLs, long-term) to return
the empty immutable array in `handler->get_properties` to avoid wasting memory.
See https://github.com/php/php-src/issues/9697#issuecomment-1273613175

The only possible internal iterator position for the empty array is at the end
of the empty array (nInternalPointer=0).
The `zend_hash*del*` helpers will always set nInternalPointer to 0 when an
array becomes empty,
regardless of previous insertions/deletions/updates to the array.
2023-02-03 09:17:33 -05:00
Derick Rethans
cb907d50a8 Merge branch 'PHP-8.1' into PHP-8.2 2023-01-31 13:00:06 +00:00
Derick Rethans
d17175cb08 Merge remote-tracking branch 'derickr/GH-10447-p-format-specifier' into PHP-8.1 2023-01-31 12:59:39 +00:00
Derick Rethans
322425eb5b Merge remote-tracking branch 'derickr/GH-10152-serialise-datetime' into PHP-8.2 2023-01-31 12:54:00 +00:00
George Peter Banyard
08f654b590
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix incorrect check in phar tar parsing
2023-01-29 17:17:21 +00:00
Niels Dossche
ec4939b170
Fix incorrect check in phar tar parsing
The entry.flags was used to check whether the entry has the directory
flag. The flags however were masked to only contain the permissions. We
need to check the mode, before the permission masking, instead of the
flags to check whether it is a directory.

Closes GH-10464

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-29 17:14:12 +00:00
Aaron Piotrowski
5e1b9666a9
[ci skip] NEWS 2023-01-28 10:18:12 -06:00
Aaron Piotrowski
284c29328e
Fix GH-10437: Set active fiber to null on bailout (#10443) 2023-01-28 10:13:58 -06:00
Arnaud Le Blanc
cfb6e82cbd [ci skip] NEWS 2023-01-27 19:37:27 +01:00
Arnaud Le Blanc
a24ac59e55 [ci skip] NEWS 2023-01-27 19:36:28 +01:00
Niels Dossche
972c74c300
Fix incorrect check in zend_internal_call_should_throw()
This debug code is part of arginfo validation. This validation will
never trigger properly because the OR operation makes the first if
always true. Fix it by changing to an AND.

Closes GH-10417

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-25 00:12:13 +00:00
George Peter Banyard
0d9bf101c4
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix incorrect check in cs_8559_5 in map_from_unicode()
  Fix incorrect page_size check
2023-01-25 00:10:56 +00:00
Niels Dossche
a8c8fb2564
Fix incorrect check in cs_8559_5 in map_from_unicode()
The condition `code == 0x0450 || code == 0x045D` is always false because
of an incorrect range check on code.
According to the BMP coverage in the encoding spec for ISO-8859-5
(https://encoding.spec.whatwg.org/iso-8859-5-bmp.html) the range of
valid characters is 0x0401 - 0x045F (except for 0x040D, 0x0450, 0x045D).
The current check has an upper bound of 0x044F instead of 0x045F.
Fix this by changing the upper bound.

Closes GH-10399

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-25 00:08:28 +00:00
Niels Dossche
b7a158a19b
Fix incorrect page_size check
The current check always evaluated to false because if `!page_size`
is true, then `page_size & (page_size - 1)` equals `0 & (0 - 1)` which
is always 0. The if condition is meant to check if page_size is zero or
not a power of two, thus we must change the AND to an OR to fix this
issue.

Closes GH-10427

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-25 00:06:56 +00:00
Tim Düsterhus
a8ecfc8a9b
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS (#10442)
2023-01-24 23:20:16 +01:00
Niels Dossche
40da9961f2
[ci skip] NEWS (#10442) 2023-01-24 23:19:21 +01:00
Máté Kocsis
7517cf3b97
Merge branch 'PHP-8.1' into PHP-8.2
- PHP-8.1:
  Fix GH-10292 1st param of mt_srand() has UNKNOWN default on PHP <8.3
2023-01-24 19:53:09 +01:00
Máté Kocsis
3197104e85
Fix GH-10292 1st param of mt_srand() has UNKNOWN default on PHP <8.3
Closes GH-10429
2023-01-24 19:05:33 +01:00
Tim Düsterhus
57b362b7a9
random: Do not trust arc4random_buf() on glibc (#10390)
This effectively reverts #8984.

As discussed in #10327 which will enable the use of the getrandom(2) syscall on
NetBSD instead of relying on the userland arc4random_buf(), the CSPRNG should
prioritize security over speed [1] and history has shown that userland
implementations unavoidably fall short on the security side. In fact the glibc
implementation is a thin wrapper around the syscall due to security concerns
and thus does not provide any benefit over just calling getrandom(2) ourselves.

Even without any performance optimizations the CSPRNG should be plenty fast for
the vast majority of applications, because they often only need a few bytes of
randomness to generate a session ID. If speed is desired, the OO API offers
faster, but non-cryptographically secure engines.
2023-01-23 18:21:42 +01:00
Arnaud Le Blanc
a0969fc7ed [ci skip] NEWS 2023-01-20 16:54:49 +01:00
Arnaud Le Blanc
f6734495f7 [ci skip] NEWS 2023-01-20 16:47:36 +01:00
Jakub Zelenka
cc931af35d
Fix GH-8086: Introduce mail.mixed_lf_and_crlf INI
When this INI option is enabled, it reverts the line separator for
headers and message to LF which was a non conformant behavior in PHP 7.
It is done because some non conformant MTAs fail to parse CRLF line
separator for headers and body.

This is used for mail and mb_send_mail functions.
2023-01-19 19:05:39 +00:00
Niels Dossche
4ea85d4044
Implement GMP::__construct()
Implements a proper constructor for GMP as discussed in both GH-10158 and https://externals.io/message/119216.
Fixes GH-10155

Closes GH-10225

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-19 14:13:34 +00:00
Christoph M. Becker
66605994ad
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix incorrect check condition in ZEND_YIELD
2023-01-18 16:28:04 +01:00
Niels Dossche
b5e9bf7775
Fix incorrect check condition in ZEND_YIELD
The condition `UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE` always
returned false, because `UNEXPECTED(expression)` always returns 0 or 1.
Move the parens so the comparison is executed properly.

Closes GH-10332.
2023-01-18 16:23:38 +01:00
Sergey Panteleev
eee988e86d
PHP-8.2 is now for PHP 8.2.3-dev 2023-01-17 20:55:22 +03:00
Patrick Allaert
c47a1a260d
PHP-8.1 is now for PHP 8.1.16-dev 2023-01-17 17:24:25 +01:00
George Peter Banyard
dd5c5ca7a5
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Handle exceptions from __toString in XXH3's initialization
  Fix phpdbg segmentation fault in case of malformed input
2023-01-17 14:16:18 +00:00
Niels Dossche
7463e70b1e
Handle exceptions from __toString in XXH3's initialization
The initialization routine for XXH3 was not prepared for exceptions from seed.
Fix this by using try_convert_to_string.

For discussion, please see: GH-10305

Closes GH-10352

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-17 14:14:12 +00:00
Niels Dossche
398a10a58a
Fix phpdbg segmentation fault in case of malformed input
If you were to enter "w $>" the function would crash with a segmentation
fault because last_index is still NULL at that point. Fix it by checking
for NULL and erroring out if it is.

Closes GH-10353

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-17 14:12:49 +00:00