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

135976 Commits

Author SHA1 Message Date
Arnaud Le Blanc
3abebf3e31 Fix JIT TLS on MacOS
The dynamic loader, starting around version 1284, patches the thunk emitted for
thread local variables by the compiler, so that its format changes from

struct Thunk {
    void *func;
    size_t module;
    size_t offset;
}

to

struct Thunk_v2 {
     void *func;
     uint32_t module;
     uint32_t offset;
     // other fields
}

which has the same size, but not the same layout.

This is mentionned in
9307719dd8/libdyld/ThreadLocalVariables.h (L90)

As a result, access to thread specific variables in JIT is broken.

Fix by using the new layout when the new dynamic loader is in use.

Closes GH-20121
2025-10-13 16:16:39 +02:00
Niels Dossche
c89f25bf69 phar: Fix file descriptor/memory leak when opening central fp fails
Closes GH-20145.
2025-10-13 09:07:37 +02:00
Niels Dossche
8a21d62c28 Update SKIPIF for bug #67563 (#20133) 2025-10-13 08:34:03 +02:00
Gina Peter Banyard
26f989313e Fix GH-20070: Return type violation in imagefilter when an invalid filter is provided
Closes GH-20071
2025-10-12 23:08:08 +01:00
Niels Dossche
f9aeb9e57c phar: Reduce code duplication wrt error handling in phar_parse_zipfile()
The PHAR_ZIP_FAIL and PHAR_ZIP_FAIL_FREE macros are almost the same.
The reason the latter exists is because of a single error path where the
error message is on the heap and needs to be freed. Instead, use a stack
allocated variable for the error message so we can get rid of the
duplicate macro code. This stack variable is big enough as the messages
written by phar_verify_signature() are short.

Closes GH-20144.
2025-10-12 23:52:23 +02:00
Niels Dossche
416386acc4 Fix memory leak in phar_parse_zipfile() error handling
Closes GH-20134.
2025-10-12 11:28:01 +02:00
Niels Dossche
efa1fafc2f Partially fix GH-16317: SimpleXML does not allow __debugInfo() overrides to work
If only we did not have the pseudo-key "@attributes", we could've just
removed the custom get_debug_info implementation and this would work out
of the box. Anyway, we just have to manually check for an override now.

Closes GH-20131.
2025-10-12 11:24:45 +02:00
Niels Dossche
9216b8be8b phar: Fix memory leak when setAlias() fails
Closes GH-20135.
2025-10-12 11:19:53 +02:00
Niels Dossche
da39975001 phar: Fix memory leak of argument in webPhar
Closes GH-20138.
2025-10-12 11:15:24 +02:00
Niels Dossche
40f4091256 Fix arginfo/zpp violations when LIBXML_SCHEMAS_ENABLED is not available
To do this, we move the macro check and therefore we also have to move
some variable declarations to avoid compiler warnings.

Closes GH-20130.
2025-10-11 23:57:11 +02:00
Arnaud Le Blanc
ab9d121f48 Fix access to uninitialized variables in preload_load()
preload_load() reads EG(class_table) and EG(function_table), but these may not
be initialized. Move these accesses out of preload_load().

Closes GH-20081
2025-10-10 15:42:58 +02:00
Jakub Zelenka
059f9f78e5 Fix GH-19974: fpm_status_export_to_zval segfault for parallel execution
The fix fixes some other races that could result in mixed up copy and
nprocs number. It requires creating a copy in a similar way like for
request status.

This was not previously used to not impact other requests. However this
does not make that much sense as the only thing that impacts it is
holding the lock and not waiting for it. It is true that if there was a
big contention then the lock would be acquired more often but that can
be achieved by using fpm_get_status in loop so it should not make a
huge difference hopefully.

Closes GH-19974
2025-10-09 21:32:04 +02:00
Niels Dossche
c5fa7696e6 Fix Randomizer::__serialize() wrt INDIRECTs
First follow-up to GH-20102.
INDIRECTs must never get exposed to userland. The simple solution is to
duplicate the properties array.

Closes GH-20103.
2025-10-08 17:38:51 +02:00
Niels Dossche
b16761ec11 Fix GH-20073: Assertion failure in WeakMap offset operations on reference
Closes GH-20078.
2025-10-07 20:16:41 +02:00
Ilija Tovilo
9b20618e1b [skip ci] Fix news entry
Every time...
2025-10-07 18:49:28 +02:00
Remi Collet
2f4b8e691a ensure test passes with prod config 2025-10-07 18:44:41 +02:00
Ilija Tovilo
9bc35f1982 Fix CGI with auto_globals_jit=0
In CGI, php_auto_globals_create_server() (i.e. auto_global_callback() here)
initializes $_ENV to reuse for $_SERVER. However, because $_SERVER is
constructed first, we have not yet initialized auto_global->armed of the $_ENV
global. Split the loop into initialization and constructor phases.

Fixes GH-19934
Closes GH-19870
2025-10-07 18:43:32 +02:00
Ilija Tovilo
59bfaa65c4 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Backport more curl 8.16 fixes
2025-10-07 18:34:03 +02:00
Ilija Tovilo
1edcce5554 Backport more curl 8.16 fixes
This hunk was missed in the 8.1 cherry-pick because curl_xferinfo() didn't exist
yet.
2025-10-07 18:33:17 +02:00
Eric Mann
91eb2a558d PHP-8.3 is now for PHP 8.3.28-dev 2025-10-07 06:58:36 -07:00
Jakub Zelenka
78a24ffc03 Update NEWS entry for curl 8.16 update 2025-10-07 14:39:53 +02:00
Jakub Zelenka
201b358c01 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Update NEWS with info about curl 8.16 compat fixes
  Fix curl_setopt_ssl test for curl 8.16
  Fix more curl 8.16 issues
  Fix curl 8.16.0 compilation with zts
  Fix curl build failure on macOS+curl 8.16
2025-10-07 14:37:47 +02:00
Jakub Zelenka
810aed1141 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Update NEWS with info about curl 8.16 compat fixes
  Fix curl_setopt_ssl test for curl 8.16
  Fix more curl 8.16 issues
  Fix curl 8.16.0 compilation with zts
  Fix curl build failure on macOS+curl 8.16
2025-10-07 14:30:22 +02:00
Jakub Zelenka
742b7d8e55 Update NEWS with info about curl 8.16 compat fixes 2025-10-07 14:25:08 +02:00
Jakub Zelenka
36859ad977 Fix curl_setopt_ssl test for curl 8.16 2025-10-07 14:18:41 +02:00
Ilija Tovilo
b810a23587 Fix more curl 8.16 issues
The CURLOPT_FOLLOWLOCATION seems like a gcc bug, where the integer extension of
bool to long is lost, but I was unable to reproduce on godbolt.org.
2025-10-07 14:18:41 +02:00
Ilija Tovilo
da75e41a6f Fix curl 8.16.0 compilation with zts 2025-10-07 14:18:41 +02:00
Niels Dossche
1c8363d2bf Fix curl build failure on macOS+curl 8.16 2025-10-07 14:18:41 +02:00
Arnaud Le Blanc
a6e81582b7 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Upgrade Alpine in nightly job
2025-10-07 10:59:23 +02:00
Arnaud Le Blanc
a30c92c9b5 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Upgrade Alpine in nightly job
2025-10-07 10:59:11 +02:00
Arnaud Le Blanc
66708de841 Upgrade Alpine in nightly job
Closes GH-20044
2025-10-07 10:58:36 +02:00
Tim Düsterhus
9d9b73a3f0 .gdbinit: Fix printing of variable names in print_cvs (#20077)
Previously only the first character of each variable was printed.
2025-10-06 20:17:53 +02:00
Niels Dossche
b7aeb0a69f Fix GH-19570: unable to fseek in /dev/zero and /dev/null
On Linux, these two character devices are exceptions in that they can be
seeked. Check their major/minor device number.

Co-authored-by: divinity76 <hans@loltek.net>
2025-10-06 18:16:16 +02:00
Alexandre Daubois
64c1d43b68 Fix GH-19926: reset internal pointer earlier while splicing array while COW violation flag is still set (#19929) 2025-10-06 16:51:23 +02:00
Leo Gaskin
7e7d6d6380 Treat accept failing with SOCK_EAGAIN as success in CLI web server
This ensures that no useless "Failed to poll event" error messages are
logged during normal server operation, as the SOCK_EAGAIN error simply
indicates another worker is already serving the request.

Closes GH-19964
2025-10-06 14:19:45 +02:00
Niels Dossche
66c833444c phar: Fix memory leaks when creating temp file fails when applying zip signature
Also fixes up the error propagation at the call site which jumped to the
wrong place in the error handling code.

Closes GH-20057.
2025-10-05 21:10:34 +02:00
Niels Dossche
4fed57e746 Fix GH-20043: array_unique assertion failure with RC1 array causing an exception on sort
The reason this happens is because the array_unique operation happens in-place
because the input array is RC1.
At one point during comparison an exception is thrown which will capture the
arguments in the backtrace, which will increment the refcount of the RC1 array
to 2. Then a modification happens after the throw on the RC2 array causing the
assertion failure.
We shouldn't try continue work after an exception happened during the sort.

Closes GH-20059.
2025-10-05 20:15:28 +02:00
Tim Düsterhus
51275be6c5 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  CI: Do not save ccache for PRs for LINUX_X32
2025-10-04 20:02:12 +02:00
Tim Düsterhus
db65d22ce2 CI: Do not save ccache for PRs for LINUX_X32
see #14168 which added this for all other builds
see 69dbfadd1e which added the LINUX_X32 build
2025-10-04 20:00:50 +02:00
Ilija Tovilo
831597748b Automatically skip tty tests if not on tty
See GH-19975
Closes GH-20013
2025-10-03 00:45:20 +02:00
Niels Dossche
eab2c2007b Fix GH-20011: Array of SoapVar of unknown type causes crash
We "guess" the type in this case, consistent with what a SoapVar would
do outside of an array.

Closes GH-20030.
2025-10-02 19:38:44 +02:00
Jakub Zelenka
288d698ce4 Prevent use after stack scope in stream strerr code (#20040) 2025-10-02 19:22:28 +02:00
Jakub Zelenka
a3c14d6ab4 Do not use errno_t as it is not defined on musl (#20037) 2025-10-02 13:42:11 +02:00
David Carlier
175afc4085 Fix GH-19705: do not flush/write buffer on non writeable stream.
Co-authored-by: Jakub Zelenka <bukka@php.net>

close GH-19708
2025-10-02 12:28:36 +01:00
Guillaume Outters
26ca363a13 Fix broken build on *BSD with MSAN
The #if to declare instrumented versions of strlcpy and strlcat was too
inclusive on *BSD systems where Clang already provides instrumented strong
symbols, resulting in "duplicate symbol" at link-time.

Fix GH-20002
Closes GH-20032
2025-10-02 00:43:50 +02:00
Niels Dossche
0ffa337a54 Fix GH-17345: Bug #35916 was not completely fixed
Change the reproducer code in `bug35916.phpt` from `stream_bucket_append` to
`stream_bucket_prepend` and you have the same bug.
Furthermore, even in the append case the check is incorrect because the bucket
can already be in the brigade at a position other than the tail.
To solve this properly, unlink the brigade first and also use that as a
condition to manage the refcount.

Closes GH-18973.
2025-10-01 11:49:28 +02:00
Alexandre Daubois
9fc14a90c6 Fix GH-16319: protect fiber backtrace with null filename from crashing (#19973) 2025-10-01 11:24:58 +02:00
Jakub Zelenka
b7fdfb7147 Fix GH-19248: Use strerror_r instead of strerror in main
Or on Windows it is going to use either FormatMessageW or strerror_s
for compatibility with previous error messages.

It also needs to accomodate for GNU and BSD versions of strerror_r
returning different type.

Closes GH-19251
2025-10-01 11:12:08 +02:00
Niels Dossche
7c859268c0 Fix memory leak and invalid continuation after tar header writing fails
Closes GH-20003.
2025-10-01 10:46:33 +02:00
Niels Dossche
c617afd6d6 Fix GH-20009: XMLReader leak on RelaxNG schema failure
Closes GH-20014.
2025-09-30 18:06:35 +02:00