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

66497 Commits

Author SHA1 Message Date
Niels Dossche
720e006982 random: Fix memory leak when serialization fails (#20383)
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2025-11-04 08:32:22 +01:00
Gina Peter Banyard
94dc6ae871 ext/pgsql: Fix segfaults when attempting to fetch row into a non-instantiable class name (#20180)
Also fix Windows CI with Postgres and CLEAN sections

---------

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-11-04 00:04:30 +00:00
David Carlier
55f7303d73 ext/zip: fix memory leak when encryption is passed as userland array option.
Similar issue fixed in GH-19936.

close GH-20363
2025-11-02 21:15:07 +00:00
Niels Dossche
be8c8a9d6b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Update zlib test to use separate file for flock()
2025-11-01 09:30:04 +01:00
Niels Dossche
df423e4f08 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Update zlib test to use separate file for flock()
2025-11-01 09:29:55 +01:00
Niels Dossche
c3d6bf65d5 Update zlib test to use separate file for flock()
This should prevent the nightly failures that fail with permission
denied on platforms with mandatory locks.

Closes GH-20351.
2025-11-01 09:29:45 +01:00
Niels Dossche
6fe40de6e3 Fix GH-20302: Freeing a phar alias may invalidate PharFileInfo objects
Closes GH-20345.
2025-10-31 08:04:25 +01:00
Calvin Buckley
d9bae1d1f5 Move iconv const check into autoconf (8.3) (#20247)
See GH-16847
2025-10-29 14:35:08 -03:00
Ilija Tovilo
76e26c6c3c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Unparallelize imap
2025-10-28 00:49:32 +01:00
Ilija Tovilo
fc1bc9c695 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Unparallelize imap
2025-10-28 00:49:26 +01:00
Ilija Tovilo
20654ce4c9 [skip ci] Unparallelize imap
It's removed for PHP 8.4 anyway, and still regularly causes "Mailbox already
exists" errors despite the flaky flag.
2025-10-28 00:48:19 +01:00
David Carlier
3c063abba1 ext/gd: Fix GH-19955 unit test.
Adding guard for imagefttext() availability.

close GH-20309
2025-10-27 17:45:17 +00:00
Niels Dossche
8761c4e507 Fix GH-20240: FTP with SSL: ftp_fput(): Connection timed out on successful writes
Looking at the strace, the timeout is only 1s which may be too low
anyway for checking for a response, but some servers also don't end up
replying finally anyway and close the connection already.

`data_available` was originally used for non-blocking downloads/uploads
and then reused for the shutdown sequence, but its error handling was
never adjusted to be silent.

Closes GH-20294.
2025-10-26 23:38:09 +01:00
Niels Dossche
61b0d589d6 ftp: Fix weird typo (#20295)
* ftp: Fix weird typo

In 8827f8eca9 the async functions were
renamed to nb functions. So this was just a find+replace of async to nb.
The diff shows that "no asyncronous transfer to continue" was replaced
with "no nbronous transfer to continue". Makes no sense.

* Update ext/ftp/php_ftp.c

Co-authored-by: Jakub Zelenka <bukka@php.net>

---------

Co-authored-by: Jakub Zelenka <bukka@php.net>
2025-10-26 08:56:56 +01:00
Niels Dossche
ed9529a7d3 Make bug70417.phpt less flaky
Closes GH-20287.
2025-10-25 12:13:58 +02:00
Niels Dossche
58df9fcf98 Fix UAF in tidy when tidySetErrorBuffer() fails
We should not free `intern` as its stored in the object store as well,
so the object store will already free it, leading to a UAF when the
object store tries to read the object's fields.

Closes GH-20276.
2025-10-24 21:19:47 +02:00
Niels Dossche
c7fc819c2d Use MYSQL_TYPE constants instead of FIELD_TYPE
The FIELD_TYPE constants are for BC. The JSON/VECTOR types are not
defined in FIELD_TYPE for libmysqlclient.
MYSQL_TYPE is available since MYSQL 5.0.0, so switch to that.

Since MYSQL_TYPEs are enums and not defines, we need version checks
instead.
JSON was added in mysql 8.0.0 in mysql/mysql-server@c240455145
JSON support was backported via mysql/mysql-server@3e14f9f in 5.7.8.
VECTOR was added in mysql 9.0.0 in mysql/mysql-server@8cd51511de

Replaces GH-20245.
2025-10-23 18:45:34 +02:00
Jakub Zelenka
eef11e048d Fix GH-19798: XP_SOCKET XP_SSL: Incorrect condition for Win
This fixes incorrect type conversion and subsequent check for Windows
where returned socket is not an int.

It should be noted that this is not really an issue as previous int
would get negative so the check should still work. The issue actually
happens only in master (PHP 8.5) where refactoring has been done and the
type changed.

Closes GH-19881
2025-10-23 15:11:14 +02:00
Niels Dossche
ce0df1a9d8 phar: Fix memory leak when opening temp file fails while trying to open gzip-compressed archive
`filterparams` can leak if `php_stream_fopen_tmpfile()` fails.
To solve this, move the temp file creation first.

Closes GH-20220.
2025-10-21 20:04:13 +02:00
Niels Dossche
cc83761416 phar: Fix file descriptor leak in phar_zip_flush() on failure.
Closes GH-20228.
2025-10-21 19:36:08 +02:00
Ilija Tovilo
b751582705 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Also skip check_default_conf_path.phpt on Windows & 8.2
  Revert "Fix Windows test for openssl-3.5 upgrade (#19384)"
2025-10-21 01:25:06 +02:00
Ilija Tovilo
f65a574a36 [skip ci] Also skip check_default_conf_path.phpt on Windows & 8.2
I don't know why the output is different only in 8.2. Revert for now to make CI
happy.
2025-10-21 01:23:58 +02:00
Ilija Tovilo
3f6c86a885 Revert "Fix Windows test for openssl-3.5 upgrade (#19384)"
This reverts commit 0e17dcfe54.
2025-10-21 01:23:29 +02:00
Ilija Tovilo
1bfe9340b7 [skip ci] Skip openssl tests currently failing on 8.2 2025-10-21 00:55:08 +02:00
Ilija Tovilo
5d8a3925d2 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix Windows test for openssl-3.5 upgrade (#19384)
2025-10-21 00:40:21 +02:00
Shivam Mathur
0e17dcfe54 Fix Windows test for openssl-3.5 upgrade (#19384)
* Fix Windows test for openssl-3.5 upgrade

* Update ext/openssl/tests/check_default_conf_path.phpt

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

---------

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2025-10-21 00:40:14 +02:00
Niels Dossche
020bbea8fd phar: Fix memory leak when openssl polyfill returns garbage
Closes GH-20210.
2025-10-20 22:03:36 +02:00
Ilija Tovilo
939b97219d Improve bug60602.phpt portability
On NixOS we need to inherit the PATH variable so we can actually resolve the
location of ls.

Closes GH-20206
2025-10-20 17:22:37 +02:00
David Carlier
ebbb1b4295 Fix GH-19021: improve tidyOptGetCategory detection
We now check both this symbol and TidyInternalCategory presence.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
2025-10-19 20:52:19 +02:00
Niels Dossche
cf3b70d23c pgsql: Fix memory leak when first string conversion fails
If the first string conversion fails, then i==0, but memory was still
allocated for `params`. However, we skip freeing `params` when i==0.

Closes GH-20213.
2025-10-18 23:59:15 +02:00
Niels Dossche
28ce1b04ef intl: Fix memory leak on error in locale_filter_matches()
Closes GH-20207.
2025-10-18 10:26:19 +02:00
Niels Dossche
94284df7b2 Fix GH-20122: getColumnMeta() for JSON-column in MySQL
While at it, also add VECTOR.

Closes GH-20143.
2025-10-16 22:55:17 +02:00
Niels Dossche
472f2fe0a3 Fix GH-8978: MySQLi: SSL certificate verification fails (port doubled)
If there are 2 ports, only the first is used.
However, then the certificate checking fails. So we drop the second port
if there is one.

Closes GH-20021.
2025-10-15 21:49:00 +02:00
Niels Dossche
56af25cc1c exif: Fix possible memory leak when tag is empty
When `!value_ptr` is handled, memory is allocated at line 3314.
At later exit paths, `outside` (pointing to `value_ptr`) is freed, but
not when exiting via the `REQUIRE_NON_EMPTY` macro.

Closes GH-20169.
2025-10-15 20:23:59 +02:00
Ilija Tovilo
ff3a12be71 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Disable inlining and inter-procedure-analyses for zend_string_equal_val() function that may be overriden for valgrind (#13099)
  Skip lc_ctype_inheritance.phpt on macos 15+
2025-10-15 19:39:03 +02:00
Ilija Tovilo
c2fd6d6c44 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Disable inlining and inter-procedure-analyses for zend_string_equal_val() function that may be overriden for valgrind (#13099)
  Skip lc_ctype_inheritance.phpt on macos 15+
2025-10-15 19:38:51 +02:00
Gina Peter Banyard
d36109bd71 ext/phar: use size_t type instead of int 2025-10-15 13:35:22 +01:00
Niels Dossche
f3cb9a81fb Wrap the normally lazy-initialized components in ZTS 2025-10-14 22:14:54 +02:00
Niels Dossche
75d8449d1f Fix not thread safe RelaxNG invocations in ZTS builds 2025-10-14 22:00:24 +02:00
SpencerMalone
f14e5fcfbd Fix not thread safe xmlSchemaParse calls in ZTS builds
By calling xmlSchemaInitTypes during MINIT.
See: https://gitlab.gnome.org/GNOME/libxml2/-/issues/930

Closes GH-20150.
2025-10-14 21:59:46 +02:00
Niels Dossche
88f8c5c0bb Fix shm corruption with coercion in options of unserialize()
Closes GH-20129.
2025-10-13 21:40:54 +02:00
Niels Dossche
5a7c84f274 phar: Fix memleak+UAF when opening temp stream in buildFromDirectory() fails
Obvious memleak, but can also cause a UAF depending on destruction
ordering with lingering PCRE regex instances in the SPL objects.

Closes GH-20157.
2025-10-13 21:02:17 +02:00
Niels Dossche
b529c77094 phar: Fix more alias memory leaks
Closes GH-20154.
2025-10-13 18:50:30 +02:00
Niels Dossche
8e0504c38b Partially fix GH-16317: DOM classes do not allow __debugInfo() overrides to work
Closes GH-20132.
2025-10-13 18:43:24 +02:00
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