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

138974 Commits

Author SHA1 Message Date
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
Ilija Tovilo
40517d0cd3 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Drop intl on macOS + PHP 8.1 build
2024-12-09 16:57:03 +01:00
Ilija Tovilo
e675c1a467 Drop intl on macOS + PHP 8.1 build
Based on the discussion in GH-16286, drop the intl build from macOS + PHP 8.1,
since we cannot build with supported intl versions without too many changes.

Closes GH-17092
See GH-16286
2024-12-09 16:55:31 +01:00
David Carlier
986dfd4e09 Merge branch 'PHP-8.3' into PHP-8.4 2024-12-09 13:16:50 +00:00
David Carlier
3bea6a2ddb ext/sockets: socket_strerror follow-up on GH-16267 fix.
boundaries should be INT_MIN <= val < INT_MAX in fact.

close GH-16891
2024-12-09 13:16:32 +00:00
Christoph M. Becker
5eed224c6c Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  opcache_get_configuration() properly reports jit_prof_threshold
2024-12-09 11:46:51 +01:00
Christoph M. Becker
3702f9783b opcache_get_configuration() properly reports jit_prof_threshold
The `jit_prof_threshold` is a float, supposed to be in range [0, 1],
and usually very small (the default is 0.005).  Reporting it as int
is meaningless.

Closes GH-17077.
2024-12-09 11:45:16 +01:00
Niels Dossche
f1b24da6b5 Fix GH-17039: PHP 8.4: Incorrect MIME content type
Backports file/file@ad925d3

Closes GH-17044.
2024-12-08 22:47:03 +01:00
David Carlier
fc3ac345d7 Merge branch 'PHP-8.3' into PHP-8.4 2024-12-08 20:30:16 +00:00
David Carlier
301b8e24c1 Fix GH-16809: fopen HTTP wrapper timeout stream context option overflow.
close GH-16810
2024-12-08 20:29:57 +00:00
Christoph M. Becker
e8bb0a8ba0 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Harden proc_open() against cmd.exe hijacking
2024-12-08 19:10:12 +01:00
Christoph M. Becker
5cbdd5f6de Harden proc_open() against cmd.exe hijacking
As is, whenever `proc_open()` needs to invoke the shell, cmd.exe is
looked up in the usual executable search path.  That implies that any
cmd.exe which is placed in the current working directory (which is not
necessarily what is reported by `getcwd()` for ZTS builds), will be
used.  This is a known attack vector, and Microsoft recommends to
always use the fully qualified path to cmd.exe.

To prevent any cmd.exe in the current working directory to be used, but
to still allow users to use a drop in replacement for cmd.exe, we
search only the `PATH` for cmd.exe (and pass the fully qualified path
to `CreateProcessW`), instead of relying on automatic executable search
by passing the base name only.

To be able to easily test this, we provide a minimalist C file which
will be build as test_helper, and used by the new test case.

[1] <https://msrc.microsoft.com/blog/2014/04/ms14-019-fixing-a-binary-hijacking-via-cmd-or-bat-file/>

Closes GH-17043.
2024-12-08 19:08:02 +01:00
Christoph M. Becker
0f5cc82fa6 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Properly check for required icu4c libraries
2024-12-07 15:11:40 +01:00
Christoph M. Becker
1800cad9d9 Properly check for required icu4c libraries
Besides that just checking for icuuc.lib does not necessarily imply
that the other libraries are available, doing it this way will not copy
the PDBs to the build folder, so these are not available in the debug
packages.  Furthermore, `CHECK_LIB` already adds the library to the
flags, so there is no need to do this manually.

Closes GH-17010.
2024-12-07 15:10:06 +01:00
Christoph M. Becker
141ee868c0 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Skip parse_ini_file_variation6.phpt on Windows
2024-12-06 23:53:47 +01:00
Christoph M. Becker
3167c7b1f2 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Skip parse_ini_file_variation6.phpt on Windows
2024-12-06 23:52:47 +01:00
Christoph M. Becker
b3b38e2d5c Skip parse_ini_file_variation6.phpt on Windows
While the test obviously succeeds on Windows, it may occasionally
conflict with parse_ini_file_variation6-win32.phpt[1], so we skip it
like we do for many other of these tests which have win32 pendants.

[1] <https://github.com/php/php-src/actions/runs/12077554275/job/33680647284#step:6:119>

Closes GH-16989.
2024-12-06 23:52:03 +01:00
Niels Dossche
953f4ef2cb Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17040: SimpleXML's unset can break DOM objects
2024-12-06 20:10:03 +01:00
Niels Dossche
7acc3ac808 Fix GH-17040: SimpleXML's unset can break DOM objects
Don't free the underlying nodes if we still have objects pointing to
them, otherwise the objects are left with a NULL node pointer.

Closes GH-17046.
2024-12-06 20:06:51 +01:00
Niels Dossche
f473e86978 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/dba/tests/gh16390.phpt: skip if inifile is disabled
2024-12-06 19:02:17 +01:00
Michael Orlitzky
def271aaa7 ext/dba/tests/gh16390.phpt: skip if inifile is disabled
This test reads an ini "file" from a string, and expects a warning
about locking. But if inifile support is disabled, then you'll get

  Warning: dba_open(): Handler "inifile" is not available in
  /path/to/ext/dba/tests/gh16390.php on line 3

instead. We skip the test if inifile support is disabled.

Closes GH-17011.
2024-12-06 19:01:50 +01:00