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

69534 Commits

Author SHA1 Message Date
Calvin Buckley
2eadc5c169 Fix skipif for mkfifo usage in gh20582.phpt
Makes it like ext/standard/tests/file/filetype_variation.phpt; it's not
just Windows that can have a missing posix_mkfifo, but also a minimal
build, like the ones suggested that RMs (using --disable-all).
2026-01-13 13:17:10 -04:00
Niels Dossche
29e04acc6f Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19962: arrayIndexThenCheck static analysis warning in firebird
2025-12-28 13:09:05 +01:00
Niels Dossche
bae78c614a Fix GH-19962: arrayIndexThenCheck static analysis warning in firebird
Same as ce534c612b.
2025-12-28 13:08:40 +01:00
Niels Dossche
fa8bb98ec0 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19961: Static analysis arrayIndexThenCheck warning in firebird (#20790)
2025-12-28 13:04:27 +01:00
Niels Dossche
ce534c612b Fix GH-19961: Static analysis arrayIndexThenCheck warning in firebird (#20790)
Static analysis reports that the bounds check comes after reading the
byte from the buffer.
In practice, this is tagged data that loops until the end tag is found
and therefore there isn't really a bug. The extra length check is only
there for extra hardening.
So we simply silence the static analysers and improve the hardening.

See also https://docwiki.embarcadero.com/InterBase/15/en/Isc_dsql_sql_info()
2025-12-28 13:04:16 +01:00
Niels Dossche
dabcd74524 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix OOB gzseek() causing assertion failure
2025-12-28 00:21:56 +01:00
Niels Dossche
2709ebc0ce Fix OOB gzseek() causing assertion failure
Closes GH-20785.
2025-12-28 00:21:32 +01:00
Niels Dossche
48b4289dff Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20582: Heap Buffer Overflow in iptcembed
2025-12-26 22:44:14 +01:00
Niels Dossche
99ed66b49f Fix GH-20582: Heap Buffer Overflow in iptcembed
If you can extend the file between the file size gathering (resulting in
a buffer allocation), and reading / writing to the file you can trigger a
TOC-TOU where you write out of bounds.
To solve this, add extra bound checks and make sure that write actions
always fail when going out of bounds.
The easiest way to trigger this is via a pipe, which is used in the
test, but it should be possible with a regular file and a quick race
condition as well.

Closes GH-20591.
2025-12-26 22:43:45 +01:00
Niels Dossche
40c291cf93 Fix GH-20444: Dom\XMLDocument::C14N() seems broken compared to DOMDocument::C14N()
C14N code expects namespace to be in-tree, but we store namespaces in a
different way out-of-tree to avoid reconciliations that break the tree
structure in a way unexpected by the DOM spec. In the DOM spec,
namespace nodes don't exist; they're regular attributes.
To solve this, we temporarily make fake namespace nodes that we later
remove.

Closes GH-20457.
2025-12-26 22:27:25 +01:00
Gina Peter Banyard
20f9772063 ext/standard: Fix memory leak in mail() when header key is numeric
Closes GH-20776
2025-12-25 19:42:31 +01:00
David Carlier
5faa54d93b ext/pcntl: fix pcntl_getcpuaffinity() for solaris.
trusting the call to handle invalid process id via errnos.

see https://github.com/php/php-src/pull/20709#discussion_r2630221301 for
rationale.

close GH-20731
2025-12-24 16:10:13 +00:00
Niels Dossche
8c860ce66e [ci skip] Add missing EXTENSIONS dependency to test 2025-12-23 11:27:34 +01:00
David Carlier
250fd02851 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/posix: (Further) fix groups array creation on macos.
2025-12-22 12:54:36 +00:00
David Carlier
e63dae2941 ext/posix: (Further) fix groups array creation on macos.
With macos Tahoe and clang "17.0.0" (Xcode) the ext/posix/tests/posix_getgrgid_macosx.phpt test crashes as follow:

ext/posix/posix.c:681:19: runtime error: load of misaligned address 0x60800000e972 for type 'char **', which requires 8 byte alignment
0x60800000e972: note: pointer points here
70 00  2a 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00
seems memcpy had been translated to a load instruction ?
anyhow, we force to copy a "proper" char * source.

close GH-20744
2025-12-22 12:53:53 +00:00
Niels Dossche
e90b48c8e5 Fix bug #74154: Phar extractTo creates empty files
The current code causes the phar entry to remain in the fname cache.
This would be fine for uncompressed phars, but is a problem for
compressed phars when they try to reopen the file pointer.
The reopen code will try to use the compressed file pointer as if it
were an uncompressed file pointer. In that case, for the given test, the
file offsets are out of bounds for the compressed file pointer because
they are the uncompressed offsets. This results in empty files.
In other cases, it's possible to read compressed parts of the file that don't
belong to that particular file.
To solve this, we simply remove the phar entry from the fname cache if
the file pointer was closed but the phar is compressed. This will make
sure that reopening the phar will not go through the cache and instead
opens up a fresh file pointer with the right decompression settings.

Closes GH-20754.
2025-12-22 12:19:21 +01:00
Niels Dossche
10bbd9590b Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  intl: Fix leak in umsg_format_helper()
2025-12-22 12:12:42 +01:00
Niels Dossche
9a7c09c963 intl: Fix leak in umsg_format_helper()
Closes GH-20756.
2025-12-22 12:06:59 +01:00
Niels Dossche
9cde911350 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Use EVP_MD_CTX_destroy() instead of EVP_MD_CTX_free() for compatibility and consistency
2025-12-21 22:29:19 +01:00
Giovanni Giacobbi
f89a3503bf Use EVP_MD_CTX_destroy() instead of EVP_MD_CTX_free() for compatibility and consistency
Closes GH-20748.
2025-12-21 22:28:57 +01:00
Niels Dossche
cf4e8e0ef6 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  phar: Fix SplFileInfo::openFile() in write mode
2025-12-21 13:18:23 +01:00
Niels Dossche
efde160ef4 phar: Fix SplFileInfo::openFile() in write mode
This stopped working after e735d2bc3b because fp_refcount is increased,
making phar think that the file has open read pointers.
To fix this, the refcount shouldn't be increased but that would
re-introduce the previous bug.
Instead, we need to add a field that "locks" the existence of the
internal entry separate from the refcount.

Closes GH-20473.
2025-12-21 13:17:54 +01:00
Niels Dossche
9686936378 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20732: Phar::LoadPhar undefined behavior when loading directory
2025-12-20 11:16:13 +01:00
Niels Dossche
22aaa20dab Fix GH-20732: Phar::LoadPhar undefined behavior when loading directory
The size of `got` was incorrect: it being unsigned means that the error
return codes are converted from -1 to SIZE_MAX. We should use ssize_t
instead.

Closes GH-20735.
2025-12-20 11:15:47 +01:00
Niels Dossche
bf63341f35 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20722: Null pointer dereference in DOM namespace node cloning via clone on malformed objects
2025-12-18 22:39:57 +01:00
Niels Dossche
983be089c0 Fix GH-20722: Null pointer dereference in DOM namespace node cloning via clone on malformed objects
Closes GH-20730.
2025-12-18 22:39:35 +01:00
Jakub Zelenka
633fb48fca Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Update NEWS with info about security issues
  Fix GHSA-www2-q4fc-65wf
  Fix GHSA-h96m-rvf9-jgm2
  Fix GHSA-8xr5-qppj-gvwj: PDO quoting result null deref
  Fix GH-20584: Information Leak of Memory
2025-12-16 15:35:25 +01:00
Jakub Zelenka
e776695abf Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Update NEWS with info about security issues
  Fix GHSA-www2-q4fc-65wf
  Fix GHSA-h96m-rvf9-jgm2
  Fix GHSA-8xr5-qppj-gvwj: PDO quoting result null deref
  Fix GH-20584: Information Leak of Memory
2025-12-16 15:34:19 +01:00
Jakub Zelenka
6e124d0df6 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Update NEWS with info about security issues
  Fix GHSA-www2-q4fc-65wf
  Fix GHSA-h96m-rvf9-jgm2
  Fix GHSA-8xr5-qppj-gvwj: PDO quoting result null deref
  Fix GH-20584: Information Leak of Memory
2025-12-16 15:30:54 +01:00
Niels Dossche
ed70b1ea43 Fix GHSA-www2-q4fc-65wf 2025-12-16 15:26:59 +01:00
Niels Dossche
8b801151bd Fix GHSA-h96m-rvf9-jgm2 2025-12-16 15:26:59 +01:00
Jakub Zelenka
727a4ddc39 Fix GHSA-8xr5-qppj-gvwj: PDO quoting result null deref 2025-12-16 15:26:59 +01:00
Niels Dossche
c5f28c7cf0 Fix GH-20584: Information Leak of Memory
The string added had uninitialized memory due to
php_read_stream_all_chunks() not moving the buffer position, resulting
in the same data always being overwritten instead of new data being
added to the end of the buffer.

This is backport as there is a security impact as described in
GHSA-3237-qqm7-mfv7 .
2025-12-16 15:26:58 +01:00
Ilija Tovilo
aaae117157 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix curl protocols test expectation
2025-12-15 23:52:00 +01:00
Ilija Tovilo
06b8b75d2e Fix curl protocols test expectation
Closes GH-17803

(cherry picked from commit 5b87faaaa7)
2025-12-15 23:51:48 +01:00
Niels Dossche
9cf6f87529 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20695: Assertion failure in normalize_value() when parsing malformed INI input via parse_ini_string()
2025-12-15 22:46:52 +01:00
Niels Dossche
85cb6e421a Fix GH-20695: Assertion failure in normalize_value() when parsing malformed INI input via parse_ini_string()
I think there's simply a reasoning error about when which scanner state
can cause which parser component to invoke later on.

Closes GH-20702.
2025-12-15 22:46:27 +01:00
Dmitry Stogov
886729454f Update IR (#20710)
IR commit: 3d72a7295c77743da22b36bab808ebb5f564488d
2025-12-15 20:13:03 +03:00
Niels Dossche
2c4163c90c Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Make bug70417.phpt less flaky
2025-12-15 08:14:48 +01:00
Niels Dossche
2bf2411976 Make bug70417.phpt less flaky
Closes GH-20287.

(cherry picked from commit ed9529a7d3)
2025-12-15 08:14:41 +01:00
Yuya Hamada
355a4b5e61 Merge branch 'PHP-8.3' into PHP-8.4 2025-12-15 10:57:21 +09:00
Yuya Hamada
0056d013bf Fix GH-20674 mb_decode_mimeheader does not handle separator
`?=  =?` is skipped if long term, so skip space character.
Add test case from RFC2047 and fix last pattern
See: https://www.ietf.org/rfc/rfc2047#section-8
2025-12-15 10:55:17 +09:00
Niels Dossche
f3d5dd0feb Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20699: SQLite3Result fetchArray return array|false, null returned
2025-12-14 23:17:58 +01:00
Niels Dossche
acd0898bdf Fix GH-20699: SQLite3Result fetchArray return array|false, null returned
Closes GH-20701.
2025-12-14 23:17:31 +01:00
Kamil Tekiela
c54abaa7e4 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Squashed commit of the following:
2025-12-14 15:28:01 +00:00
Kamil Tekiela
dbf56e0eba Squashed commit of the following:
commit c4adcbe582
Author: Kamil Tekiela <tekiela246@gmail.com>
Date:   Fri Oct 17 15:32:14 2025 +0100

    Add NEWS

commit 84a6e675af
Author: Kamil Tekiela <tekiela246@gmail.com>
Date:   Fri Oct 17 14:49:26 2025 +0100

    Handle errors in mysqli_begin_transaction
2025-12-14 15:25:34 +00:00
David Carlier
90475249dd Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20678: resource created by GlobIterator crashes with fclose().
2025-12-14 11:58:41 +00:00
David Carlier
97a90f4361 Fix GH-20678: resource created by GlobIterator crashes with fclose().
close GH-20697
2025-12-14 11:58:18 +00:00
Niels Dossche
c1c3bcc46b Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  standard: Fix error check for proc_open() command
2025-12-13 11:58:25 +01:00
Niels Dossche
038e53420b standard: Fix error check for proc_open() command
zval_get_string() can never return NULL, you need to use the try version
to get NULL. This is observable because the process will still spawn
even if an exception had occurred. To fix this, use the try variant.

Closes GH-20650.
2025-12-13 11:57:54 +01:00