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

139629 Commits

Author SHA1 Message Date
Ilija Tovilo
f11d9b522d Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix duplicate dynamic properties in hooked object iterator properties table
2024-12-09 17:08:31 +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
670f78f56c Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport JIT fix: set valid EX(opline) before calling gc_possible_root() (#16858)
2024-12-09 17:00:23 +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
067a17de48 Merge branch 'PHP-8.4'
* PHP-8.4:
  Drop intl on macOS + PHP 8.1 build
2024-12-09 16:57:27 +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
94d9cc1266 Merge branch 'PHP-8.4' 2024-12-09 13:17:29 +00: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
03731570cf Fix GH-16843: Windows phpize builds ignore source subfolders
phpize builds on Windows ignore the paths of extension sources, and
build all object files in the same folder.  This can't work if there
are multiple source files with the same base name stored in separate
folders and registered as such (e.g. cls/worker.c and src/worker.c).
While extension authors can work around by avoiding duplicate base
names, they may not even be aware of the problem because on POSIX
systems, the object files are usually placed right besides the sources.

Thus we take the relative path (from `configure_module_dirname`) of the
source files into account even for phpize builds.  Since this may break
some extension builds (especially those which use Makefile fragments),
we do not apply this fix to stable branches.

Closes GH-17016.
2024-12-09 12:33:26 +01:00
Christoph M. Becker
85731e8830 [skip ci] Add nightly job for x64 Windows with ASan enabled
It seems reasonable to have an ASan job on Windows, especially to be
able to check Windows specific code.  Since the tests may take about
70 minutes, it doesn't make sense to add these for pushes, but for a
nightly job that should be okay.

Closes GH-17087.
2024-12-09 12:01:19 +01:00
Christoph M. Becker
e5b4743d38 Merge branch 'PHP-8.4'
* PHP-8.4:
  opcache_get_configuration() properly reports jit_prof_threshold
2024-12-09 11:47:26 +01: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
Christoph M. Becker
c0385e978a Guard config.w32.h from multiple inclusion (GH-17021)
Besides that is generally good practice to avoid macro redefinitions
(and symbol redeclarations), and we're doing this on POSIX platforms
anyway, there is a particular issue regarding phpize builds, where
config.w32.h actually includes config.pickle.h.  The latter overrides
some macro definitions (e.g. `PHP_BUILD_SYSTEM`) to define the proper
values, but if config.w32.h is included multiple times, different macro
definitions eventually raise C4005 compiler warnings[1], which break
builds with `/WX /W1` enabled.

[1] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4005>
2024-12-08 23:42:34 +01:00
Niels Dossche
751eabb796 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17039: PHP 8.4: Incorrect MIME content type
2024-12-08 22:47:17 +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
ba432c7a47 Merge branch 'PHP-8.4' 2024-12-08 20:30:57 +00: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
3ee522a31d Merge branch 'PHP-8.4'
* PHP-8.4:
  Harden proc_open() against cmd.exe hijacking
2024-12-08 19:10:39 +01: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
7ce879189f Unblock tests under ASan on Windows
These tests execute php.exe without passing the PATH, what might be a
more general issues, but at least with ASan enabled, the required DLLs
could usually not be found, resulting in the tests stalling.

Closes GH-17079.
2024-12-08 18:42:31 +01:00
Niels Dossche
c5d9c7da9e Port Firebird x32 task to nightly (#17080) 2024-12-07 23:35:26 +01:00
Christoph M. Becker
b614b4a69a GH-16889: stream_select() timeout useless for pipes on Windows
Pipes are blocking on Windows, but `php_select()` always returns them
as ready for read/write.  This renders the `stream_select()` timeout
useless, what can cause a following read to block for a very long time.

While there is no general fix (and least not within reach for a stable
version), we can at least cater to the important case of read pipes by
peeking the pipe to check whether data is available.  If there is none,
we do not add the handle to the read set.

We need to fix a couple of tests cases:

* bug60692.phpt and bug64770.phpt assume that at least the stdin and
  stdout pipes are always selected as readable, and that the select
  call will not change their order.  We're being more defensive now.
* the potentials warnings of bug49936_win32.phpt need to be suppressed,
  like it has been done earlier for the POSIX variant of this test
  case[1].  Possibly this test case should be dropped altogether[2].

[1] <c884d3782c>
[2] <2c6b85f6fe>

Closes GH-16917.
2024-12-07 16:44:11 +01:00
Christoph M. Becker
d98e1918cb [skip ci] Fix UPGRADING
--enable-sanitizer is not supported with MSVC 16.9, but only 16.10.
2024-12-07 16:25:48 +01:00
Christoph M. Becker
c9cc89cd8e Support --enable-sanitizer for MSVC builds
While it is already possible to enable ASan for MSVC (assuming Visual
Studio 2019 16.10 or later) by passing `/fsanitizer=address` in the
`CFLAGS`, it is only usable if `ZEND_DEBUG` is also enabled; otherwise
there are `STATUS_BACK_STACK` errors all the time.

Since it makes some sense to combine ASan instrumentation with debug
assertions enabled anyway (typical for fuzzing), we support the
configure option `--enable-sanitizer`, which is already supported for
Clang builds, also for MSVC builds.  Note that MSVC supports only ASan
for now; contrary to Clang which additionally supports UBSan on Windows.

Since ASan reports can be pretty useless without debug symbol
information, we require such builds to also produce PDBs (i.e.
`--enable-debug-pack`), but forbid actual debug builds (for performance
reasons, and because the way it is implemented it would not make sense;
that was already an issue with Clang builds with sanitizers enabled).

Closes GH-16999.
2024-12-07 16:21:16 +01:00
Christoph M. Becker
d18b7220a1 Merge branch 'PHP-8.4'
* PHP-8.4:
  Properly check for required icu4c libraries
2024-12-07 15:11:58 +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
a7aba3571f Merge branch 'PHP-8.4'
* PHP-8.4:
  Skip parse_ini_file_variation6.phpt on Windows
2024-12-06 23:54:19 +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
Christoph M. Becker
d09cc33190 Fix typo in "private" function name (Windows configuration) (GH-17069)
This typo is particularly annoying if you search for "ldflags", because
you won't find this function.
2024-12-06 23:42:15 +01:00
Niels Dossche
fc48fd8653 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17040: SimpleXML's unset can break DOM objects
2024-12-06 20:10:08 +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
DanielEScherzer
b5c3c2d1d5 ext/date: reduce duplication in __wakeup() methods (#15791)
The only difference between `DateTime::__wakeup()` and
`DateTimeImmutable::__wakeup()` is which class name is included in the error
message if the initialization from the data fails. Factor out a helper method
that is given the class name, and use it for both methods.
2024-12-06 19:23:32 +01:00
Niels Dossche
b63db81086 Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/dba/tests/gh16390.phpt: skip if inifile is disabled
2024-12-06 19:02:22 +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
Niels Dossche
559eb7ff26 Fix integer overflows in timelib
There are edge cases where computations can cause an integer overflow,
which is undefined behaviour. Lately, some fuzzers seem to be hitting
these quite frequently. While this behaviour is undefined, it doesn't
actually matter in practice, the worst effect is having a wrong
computation result, but no sane person would do computations on e.g. the
year pow(2,63).

Still, undefined behaviour is bad.
Make the wrapping behaviour defined by using -fwrapv when possible.
The scope of this is limited to timelib and doesn't affect php_date.c.

The reason for this is that this may in theory prevent some
optimizations and it also seems bad to affect code that lives so close
to the PHP-native edge.

I tested all issues.
This fixes all but one issues, the remaining issue is in php_date.c.

Fixes GH-13881.
Fixes GH-14075.
Fixes GH-15150.
Fixes GH-16034.
Fixes GH-16035.
Fixes GH-16048.
Fixes GH-16050.
Fixes GH-16051.
Fixes GH-16052.
Fixes GH-16775.
Fixes GH-16864.
Fixes GH-16865.
Fixes GH-16975.
Fixes GH-17025.
Fixes GH-17059.
Closes GH-17060.
2024-12-06 18:56:57 +01:00