1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Commit Graph

138994 Commits

Author SHA1 Message Date
Saki Takamachi
52ebdfbe00 Correctly round rounding mode with zero edge case (#17065)
Fixes #17064
Closes #17065
2024-12-17 00:17:23 +09:00
Gina Peter Banyard
47b262086a Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/pcntl: Fix memory leak in cleanup code of pcntl_exec()
2024-12-15 22:13:54 +00:00
Gina Peter Banyard
2df9f32732 ext/pcntl: Fix memory leak in cleanup code of pcntl_exec() 2024-12-15 22:13:27 +00:00
Niels Dossche
08b14a57b8 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17162: zend_array_try_init() with dtor can cause engine UAF
2024-12-15 20:12:12 +01:00
Niels Dossche
ee0daa59db Fix GH-17162: zend_array_try_init() with dtor can cause engine UAF
Closes GH-17167.
2024-12-15 20:11:40 +01:00
David Carlier
171cc5c6e0 fix pgsql config inclusion 2024-12-15 16:05:10 +00:00
David Carlier
1bb4bd657f fix new pgsql test 2024-12-15 15:22:35 +00:00
David Carlier
2309cac755 Merge branch 'PHP-8.3' into PHP-8.4 2024-12-15 14:55:36 +00:00
David Carlier
0a3442fbe6 ext/pgsql fixing further calls with flexible arguments number.
continuation of GH-17161

close GH-17165
2024-12-15 14:50:59 +00:00
Niels Dossche
57eb399700 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17137: Segmentation fault ext/phar/phar.c
2024-12-15 13:55:44 +01:00
Niels Dossche
142f85e2e1 Fix GH-17137: Segmentation fault ext/phar/phar.c
Commit edae2431 attempted to fix a leak and double free, but didn't
properly understand what was going on, causing a reference count mistake
and subsequent segfault in this case.

The first mistake of that commit is that the reference count should've
been increased because we're reusing a phar object. The error handling
path should've gotten changed instead to undo this refcount increase
instead of not refcounting at all (root cause of this bug).

The second mistake is that the alias isn't supposed to be transferred or
whatever, that just doesn't make sense. The reason the test
bug69958.phpt originally leaked is because in the non-reuse case we
borrowed the alias and otherwise we own the alias. If we own the alias
the alias information shouldn't get deleted anyway as that would desync
the alias map.

Fixing these will reveal a third issue in which the alias memory is not
always properly in sync with the persistence-ness of the phar, fix this
as well.

Closes GH-17150.
2024-12-15 13:50:09 +01:00
Christoph M. Becker
fd25b79412 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Don't run proc_open_cmd.phpt in parallel with other tests
2024-12-15 12:10:47 +01:00
Christoph M. Becker
aafa6ea386 Don't run proc_open_cmd.phpt in parallel with other tests
This test puts a fake cmd.exe in the CWD and removes it only after the
test has finished.  We need to avoid that other tests are running while
that fake cmd.exe is there, because they may use it instead of the
proper cmd.exe.

We also unlink the fake cmd.exe as soon as possible, regardless of the
test result.

Fixes GH-17098.
Closes GH-17090.
2024-12-15 12:09:42 +01:00
Niels Dossche
aea64c89f2 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17153: SimpleXML crash when using autovivification on document
2024-12-15 11:32:02 +01:00
Niels Dossche
a57a434f95 Fix GH-17153: SimpleXML crash when using autovivification on document
In the case of a member string, `mynode` may also be a document, which
doesn't have a namespace.

Closes GH-17156.
2024-12-15 11:31:32 +01:00
Niels Dossche
e562b8cf8e Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17158: pg_fetch_result Shows Incorrect ArgumentCountError Message when Called With 1 Argument
2024-12-14 19:49:04 +01:00
Niels Dossche
388f63c310 Fix GH-17158: pg_fetch_result Shows Incorrect ArgumentCountError Message when Called With 1 Argument
Closes GH-17161.
2024-12-14 19:48:40 +01:00
Jakub Zelenka
0cc0c7c7d9 Merge branch 'PHP-8.3' into PHP-8.4 2024-12-14 15:01:17 +01:00
Jakub Zelenka
3490ac0cb3 Fix GH-13437: FPM: ERROR: scoreboard: failed to lock (already locked)
This changes locking for scoreboard to reduce contention between readers
and adds retries for acquiring scoreboard for read.

Closes GH-15805
2024-12-14 14:59:56 +01:00
Niels Dossche
4656c22526 Fix GH-17145: DOM memory leak
Because the use of RETURN instead of RETVAL, the freeing code could not
be executed. This only is triggerable if the content of the attribute is
mixed text and entities, so it wasn't noticed earlier.

Closes GH-17147.
2024-12-14 12:12:40 +01:00
Dmitry Stogov
ccc6c0f78c Fix GH-15709: Crashing tests on Windows x64 (#17095)
This is a quick fix for the problem.
It'll work while all the JIT-ed functions have the same "fixed stack frame".
Unwinder uses hard-coded unwind data for this "fixed stack frame".

* Preallocate space for Win64 shadow args

* typo

* Setup unwinder for JIT functions

* Revert "Dynamically xfail test case which fails on CI"

This reverts commit 7cc327fd5a.

* Revert "Dynamically xfail test case which fails on CI"

This reverts commit bdde797159.

* Revert "Dynamically xfail test cases which fail on CI (GH-15710)"

This reverts commit 6d5962074f.

* Remove XFAIL sections

* Add hard-coded SEH unwind data for EXITCALL

* Fix unwind data

* Fix Windows multi-process support

* Typo
2024-12-13 02:05:45 +03:00
Ilija Tovilo
b86308c222 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Hide xfail/xleak test summary
2024-12-12 13:12:58 +01:00
Ilija Tovilo
e7af08d625 Hide xfail/xleak test summary
We don't show succeeding tests in the summary, and for all intents and purposes,
these tests have succeeded, in that they behave as expected. I've seen the
output confuse people on multiple occasions, for example GH-17105.

Closes GH-17109
2024-12-12 13:12:46 +01:00
Ilija Tovilo
901ce61105 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix ZEND_MATCH_ERROR misoptimization
2024-12-12 13:11:29 +01:00
Ilija Tovilo
cdfd960150 Fix ZEND_MATCH_ERROR misoptimization
op1 of ZEND_MATCH_ERROR, which refers to the match expression, is not freed by
MATCH_ERROR itself. Instead, it is freed by ZEND_HANDLE_EXCEPTION. For normal
control flow, a FREE is placed at the end of the match expression.

Since FREE may appear after MATCH_ERROR in the opcode sequence, we need to
correctly handle op1 of MATCH_ERROR as alive.

Fixes GH-17106
Closes GH-17108
2024-12-12 13:10:34 +01:00
Niels Dossche
901ebd1c1a Update HTML5 serializer comments 2024-12-11 19:48:47 +01:00
Niels Dossche
ab47c189f3 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Resolve GH-17112 for lower branches
2024-12-11 19:32:48 +01:00
Niels Dossche
754aa7706b Resolve GH-17112 for lower branches
See https://github.com/php/php-src/pull/17114#issuecomment-2533050450
2024-12-11 19:32:36 +01:00
Ilija Tovilo
d90b5fa3f0 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport flaky flag for phar tests
2024-12-10 10:36:33 +01:00
Ilija Tovilo
1862aff08f Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Backport flaky flag for phar tests
2024-12-10 10:36:26 +01:00
Ilija Tovilo
fa64a1dcd9 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Backport flaky flag for phar tests
2024-12-10 10:36:17 +01:00
Ilija Tovilo
8a9d45b86f Backport flaky flag for phar tests
4e12189604
b6ca871396
062837aa13
2024-12-10 10:35:00 +01:00
Jakub Zelenka
7d77082dca Merge branch 'PHP-8.3' into PHP-8.4 2024-12-09 23:37:31 +01:00
Jakub Zelenka
5168a2f5ba Merge branch 'PHP-8.2' into PHP-8.3 2024-12-09 23:37:03 +01:00
Jakub Zelenka
d18768e231 Merge branch 'PHP-8.1' into PHP-8.2 2024-12-09 23:36:36 +01:00
Jakub Zelenka
39c292b1eb Use empheral port for mysqli fake server tests 2024-12-09 23:34:50 +01:00
Niels Dossche
226a0c5131 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix bug #79075: FFI header parser chokes on comments
2024-12-09 22:30:23 +01:00
Niels Dossche
612a34cbec Fix bug #79075: FFI header parser chokes on comments
The directives for FFI should be first in the file, which is fine,
however sometimes there can be comments or whitespace before or between
these defines. One practical example is for license information or when
a user adds newlines "by accident". In these cases, it's quite confusing
that the directives do not work properly.
To solve this, make the zend_ffi_parse_directives() aware of comments.

Closes GH-17082.
2024-12-09 22:29:02 +01:00
Niels Dossche
e9b3b9f8c4 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport GH-16348
2024-12-09 21:00:53 +01:00
Niels Dossche
b2e5b05969 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Backport GH-16348
2024-12-09 21:00:36 +01:00
Niels Dossche
53d4651187 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Backport GH-16348
2024-12-09 21:00:25 +01:00
Niels Dossche
806d2e073c Backport GH-16348
Agreed by RM: https://github.com/php/php-src/issues/16168#issuecomment-2525433557

The inline assembly uses labels with the prefix `.L`. On Linux systems
this is the local label prefix. It appears that macOS uses `L` as a
local prefix, which means that the prefix used in the inline assembly is not
local for macOS systems [1].
When combined with inlining, this causes the compiler to get confused
and merge a part of the inline assembly between different functions,
causing control flow to jump from one function to another function.
This is avoided on PHP 8.2 and up by the fact that it
uses `zend_never_inline NOIPA`, but nothing guarantees that compiler
changes won't affect this as well.

To solve this issue, we instead use local labels. These will make the
compiler pick the correct prefix, preventing the issue.

Additionally, while here, we also change the computation of `delta`.
It is undefined behaviour to compute the pointer difference between
two different objects. To circumvent this, we cast first to `uintptr_t`.

This change is cleanly backportable to 8.1 for vendors to pick up.

[1] https://github.com/php/php-src/issues/16168#issuecomment-2404792553

With the help of investigation and testing of @ryandesign.

Closes GH-16348.
2024-12-09 21:00:05 +01:00
Ilija Tovilo
792f63df45 Fix unstable get_iterator pointer for hooked classes in shm on Windows
Closes GH-17034
2024-12-09 17:14:19 +01:00
Ilija Tovilo
84917300b2 Fix duplicate dynamic properties in hooked object iterator properties table
Ouch, Z_TRY_ADDREF_P() uses pz twice... Also make sure we actually reserve
enough Buckets for all dynamic properties.

Fixes OSS-Fuzz #382922236
Closes GH-17085
2024-12-09 17:07:57 +01:00
Ilija Tovilo
7b5141b85d Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport JIT fix: set valid EX(opline) before calling gc_possible_root() (#16858)
2024-12-09 17:00:19 +01:00
Ilija Tovilo
d9aa27e5aa Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Backport JIT fix: set valid EX(opline) before calling gc_possible_root() (#16858)
2024-12-09 17:00:15 +01:00
Ilija Tovilo
483f265e61 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Backport JIT fix: set valid EX(opline) before calling gc_possible_root() (#16858)
2024-12-09 17:00:08 +01:00
Dmitry Stogov
b0b39cdc3e Backport JIT fix: set valid EX(opline) before calling gc_possible_root() (#16858)
This will finally make the COMMUNTIY build of the PHP 8.1 build green.

See https://github.com/php/php-src/pull/16858#issuecomment-2509010556
Closes GH-17091
2024-12-09 16:59:41 +01:00
Ilija Tovilo
c52beea50e Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Drop intl on macOS + PHP 8.1 build
2024-12-09 16:57:20 +01:00
Ilija Tovilo
bf0d440fcb Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Drop intl on macOS + PHP 8.1 build
2024-12-09 16:57:10 +01:00