2036 Commits
Author SHA1 Message Date
Ilia Alshanetsky 206b408e2f Merge branch 'PHP-8.6' 2026-10-27 10:51:04 -04:00
Ilia Alshanetsky 300bb17e36 Merge branch 'PHP-8.5' into PHP-8.6 2026-10-27 10:39:45 -04:00
Ilia Alshanetsky 1c96238e5e Merge branch 'PHP-8.4' into PHP-8.5 2026-10-27 10:39:38 -04:00
lazerg f9129bd1a1 ext/phar: Bound tar metadata size before allocation
Reject oversized metadata entries before allocating their contents so
malformed archives fail without exhausting the memory limit.

Fixes GH-24740
Closes GH-24742
2026-10-27 10:39:15 -04:00
Georgij Tsarin 857ac7f0b3 ext/phar: add upper-bound check on LongLink entry size (#24423) 2026-10-19 22:57:50 +02:00
Jakub Zelenka d418a62648 ext/phar: Fix double-free in webPhar() without PATH_INFO (#24166)
In the CGI/FastCGI branch of webPhar(), when SCRIPT_NAME is present but
PATH_INFO is absent, path_info was aliased to the testit buffer and
free_pathinfo was set. Since commit 3ee2f442d2 added an unconditional
efree(testit) after that branch, path_info became a dangling pointer.
This causes a use-after-free when path_info is read later and a
double-free at cleanup_skip_entry when free_pathinfo triggers
efree(path_info).

The regression was introduced in PHP 8.6. Earlier release branches do
not free testit at this point.

Allocate a dedicated copy for path_info so its lifetime outlives the
efree(testit).

Reported by RigelYoung.

Closes #24166
2026-10-07 01:52:58 +08:00
Daniel Scherzer 90a5c12dcb [%pS migration] Use %pS in ext/phar/util.c 2026-10-04 22:59:54 -07:00
Daniel Scherzer 686b597102 [%pS migration] Use %pS in ext/phar/tar.c 2026-10-04 22:59:54 -07:00
Daniel Scherzer b044cefe52 [%pS migration] Use %pS in ext/phar/stream.c 2026-10-04 22:59:53 -07:00
Daniel Scherzer 7ae1cd5ccb [%pS migration] Use %pS in ext/phar/phar.c 2026-10-04 22:59:53 -07:00
Daniel Scherzer fe1f83ecd0 [%pS migration] Use %pS in ext/phar/phar_object.c 2026-10-04 22:59:50 -07:00
Daniel Scherzer 5974b8e4c5 [%pS migration] Use %pS in ext/phar/func_interceptors.c 2026-10-04 22:56:53 -07:00
Daniel Scherzer 24b6846bd6 [%pS migration] Use %pS in ext/phar/dirstream.c 2026-10-04 22:56:53 -07:00
Jakub Zelenka 48e53b0921 Merge branch 'PHP-8.5'
* PHP-8.5:
  Skip bz2 GH-20807 test when less than 13 GiB of memory is available
  ext/soap: make GHSA-cj93-vc83-wgqv test lean and reliable
  Add NEWS entries
  ext/standard: Fix 1-char relative Location redirects after GH-23467
  [http] Fix out-of-bounds read on empty Location header
  Fix GHSA-ch8v-r6jh-4vvr: encode 0xFF in FILTER_SANITIZE_ENCODED
  Fix GHSA-9f67-6fw4-hpfp
  Fix GHSA-j3wh-g957-2m85: phar tar entry injection
  Fix GHSA-cj93-vc83-wgqv
  Fix GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap XML parsing and decoding
  Fix GHSA-fpwc-w8rq-cr92: strip credentials from user headers on cross-origin redirects
  Fix GHSA-r6x9-5r99-36j7: Various packet overreads in mysqlnd wireprotocol
  Fix GHSA-xr7j-rvgx-xq5p: OOB read in php_openssl_matches_wildcard_name()
  Fix GHSA-vvx9-73fr-5jjx: do not fall back to CN if the cert has a service ID
  Fix GHSA-62xp-839h-2637: FastCGI allowed_clients compared only 96 bits of IPv6 addresses
  Fix heap-buffer-overflow in convert stream filters with NUL in line-break-chars

# Conflicts:
#	NEWS
#	ext/openssl/xp_ssl.c
#	ext/phar/tar.c
#	ext/soap/php_http.c
#	ext/standard/http_fopen_wrapper.c
2026-09-22 11:15:26 +02:00
Jakub Zelenka 2ef7525be7 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Skip bz2 GH-20807 test when less than 13 GiB of memory is available
  ext/soap: make GHSA-cj93-vc83-wgqv test lean and reliable
  Add NEWS entries
  ext/standard: Fix 1-char relative Location redirects after GH-23467
  [http] Fix out-of-bounds read on empty Location header
  Fix GHSA-ch8v-r6jh-4vvr: encode 0xFF in FILTER_SANITIZE_ENCODED
  Fix GHSA-9f67-6fw4-hpfp
  Fix GHSA-j3wh-g957-2m85: phar tar entry injection
  Fix GHSA-cj93-vc83-wgqv
  Fix GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap XML parsing and decoding
  Fix GHSA-fpwc-w8rq-cr92: strip credentials from user headers on cross-origin redirects
  Fix GHSA-r6x9-5r99-36j7: Various packet overreads in mysqlnd wireprotocol
  Fix GHSA-xr7j-rvgx-xq5p: OOB read in php_openssl_matches_wildcard_name()
  Fix GHSA-vvx9-73fr-5jjx: do not fall back to CN if the cert has a service ID
  Fix GHSA-62xp-839h-2637: FastCGI allowed_clients compared only 96 bits of IPv6 addresses
  Fix heap-buffer-overflow in convert stream filters with NUL in line-break-chars

# Conflicts:
#	NEWS
#	ext/phar/tar.c
#	ext/soap/php_http.c
#	ext/soap/php_xml.c
#	ext/standard/http_fopen_wrapper.c
#	win32/ioutil.c
2026-09-22 11:14:09 +02:00
Jakub Zelenka 2cd16757b2 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/soap: make GHSA-cj93-vc83-wgqv test lean and reliable
  Add NEWS entries
  ext/standard: Fix 1-char relative Location redirects after GH-23467
  [http] Fix out-of-bounds read on empty Location header
  Fix GHSA-ch8v-r6jh-4vvr: encode 0xFF in FILTER_SANITIZE_ENCODED
  Fix GHSA-9f67-6fw4-hpfp
  Fix GHSA-j3wh-g957-2m85: phar tar entry injection
  Fix GHSA-cj93-vc83-wgqv
  Fix GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap XML parsing and decoding
  Fix GHSA-fpwc-w8rq-cr92: strip credentials from user headers on cross-origin redirects
  Fix GHSA-r6x9-5r99-36j7: Various packet overreads in mysqlnd wireprotocol
  Fix GHSA-xr7j-rvgx-xq5p: OOB read in php_openssl_matches_wildcard_name()
  Fix GHSA-vvx9-73fr-5jjx: do not fall back to CN if the cert has a service ID
  Fix GHSA-62xp-839h-2637: FastCGI allowed_clients compared only 96 bits of IPv6 addresses
  Fix heap-buffer-overflow in convert stream filters with NUL in line-break-chars

# Conflicts:
#	ext/openssl/xp_ssl.c
2026-09-22 11:03:08 +02:00
Jakub Zelenka f9e04180ae Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/soap: make GHSA-cj93-vc83-wgqv test lean and reliable
  Add NEWS entries
  ext/standard: Fix 1-char relative Location redirects after GH-23467
  [http] Fix out-of-bounds read on empty Location header
  Fix GHSA-ch8v-r6jh-4vvr: encode 0xFF in FILTER_SANITIZE_ENCODED
  Fix GHSA-9f67-6fw4-hpfp
  Fix GHSA-j3wh-g957-2m85: phar tar entry injection
  Fix GHSA-cj93-vc83-wgqv
  Fix GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap XML parsing and decoding
  Fix GHSA-fpwc-w8rq-cr92: strip credentials from user headers on cross-origin redirects
  Fix GHSA-r6x9-5r99-36j7: Various packet overreads in mysqlnd wireprotocol
  Fix GHSA-xr7j-rvgx-xq5p: OOB read in php_openssl_matches_wildcard_name()
  Fix GHSA-vvx9-73fr-5jjx: do not fall back to CN if the cert has a service ID
  Fix GHSA-62xp-839h-2637: FastCGI allowed_clients compared only 96 bits of IPv6 addresses
  Fix heap-buffer-overflow in convert stream filters with NUL in line-break-chars
2026-09-22 10:54:22 +02:00
Jordi Kroon 3036712be9 tree: Add #[\SensitiveParameter] to more functions taking secrets (#23782)
* ext/sodium: add SensitiveParameter to missing functions

* ext/phar: add SensitiveParameter to missing functions

* ext/snmp: add SensitiveParameter to missing functions

* ext/sqlite3: add SensitiveParameter to missing functions

* ext/hash: add SensitiveParameter to missing functions
2026-09-21 12:19:04 +01:00
Jakub Zelenka 0994e2e887 Fix GHSA-j3wh-g957-2m85: phar tar entry injection
Reject entry sizes that cannot be parsed or represented, and skip the data
blocks of every entry type that carries data. Both left the stream on
attacker controlled data that was then parsed as a tar header.
2026-09-18 22:26:47 +02:00
Jakub Zelenka a546219941 main/streams: Keep context alive during stream error finalization
Fixes GH-23259
Fixes GH-23264
2026-09-16 22:09:39 +02:00
Jakub ZelenkaandIlija Tovilo c07cc8502c Fix bug #60110 (fclose(), file_put_contents(), copy() do not return false properly) (#12067)
Propagate stream flush and close failures to the return value.

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2026-09-15 20:13:27 +02:00
Weilin Du 0a40e06e69 Merge branch 'PHP-8.5'
* PHP-8.5:
  Merge branch 'PHP-8.4' into PHP-8.5
2026-08-28 01:07:37 +08:00
Weilin Du cd99c6c8d0 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-23477: Memory leak on duplicate native Phar manifest entries (#23479)
2026-08-28 01:06:11 +08:00
Weilin Du a1b68afe09 Fix GH-23477: Memory leak on duplicate native Phar manifest entries (#23479)
Check the insertion result and release these allocations on failure.
2026-08-28 01:03:13 +08:00
Weilin Du a6b1a9eb59 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-23418: UAF when accessing mounted Phar subdirectories (#23442)
2026-08-27 00:13:12 +08:00
Weilin Du c91cc1a25d Merge branch 'PHP-8.4' into PHP-8.5
* origin/PHP-8.4:
  Fix GH-23418: UAF when accessing mounted Phar subdirectories (#23442)
2026-08-27 00:12:16 +08:00
Weilin Du 12b1f654db Fix GH-23418: UAF when accessing mounted Phar subdirectories (#23442)
Here we passes a properly null-terminated copy of the shortened path
to `phar_mount_entry()` instead and keep `test` alive until error
formatting and manifest lookup have completed.
2026-08-27 00:09:11 +08:00
Gina Peter Banyard ac3ff655ea spl: deprecate SplFileObject CSV methods (#23437)
RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_splfileobject_csv_methods
2026-08-25 11:03:22 +01:00
Gina Peter Banyard ee908f5542 Zend: normalise behaviour around class name ZPP specifier (#23359)
Splitting the behavioural change of #23052 out into this and come up with something that is hopefully more sensible and consistent between fast and slow ZPP and the object or class_name Fast ZPP specifier.
2026-08-21 13:31:45 +01:00
Arshid 1f0e6ef98a ext/spl: Narrow tentative return types for DirectoryIterator methods (#22642) 2026-08-15 14:31:09 +02:00
Weilin Du 5332ab0c29 ext/phar: only .phar extensions in file names trigger automatic archive detection (#23260)
Fixed Phar archives being automatically detected when ".phar" only occurs
in a directory name or is not a filename extension in an included file's path.
2026-08-15 03:00:26 +08:00
Weilin Du 600e4a8445 tree-wide: Refactor with zend_string_ends_with* (#23216) 2026-08-14 17:01:16 +08:00
NickSdot 7334dcf5cc Applied fixers to improve test robustness (ext/intl, ext/phar) (#22985)
This commit hardens tests in the phar and intl extension. By:
- Testing exception type in error tests, and formating them consistently.
- Removing useless blank lines
2026-08-01 19:05:24 +08:00
Ilija Tovilo 56b8d1040d Fix string freeing in phar_follow_one_link()
Faulty merge on my part.
2026-07-28 12:04:27 +02:00
Ilija Tovilo fb21752483 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix out-of-bounds write in ext-bcmath bccomp() via bc_str2num()
  Add NEWS entries
  Fix GHSA-vc5h-9ppw-p5f3: phar circular symlink crash
  Fix SQL injection in ext-pgsql via E'...' backslash breakout
  libgd patch for CVE-2026-9672
2026-07-28 11:58:05 +02:00
Ilija Tovilo e5c3b4b083 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix out-of-bounds write in ext-bcmath bccomp() via bc_str2num()
  Add NEWS entries
  Fix GHSA-vc5h-9ppw-p5f3: phar circular symlink crash
  Fix SQL injection in ext-pgsql via E'...' backslash breakout
  libgd patch for CVE-2026-9672
2026-07-28 11:51:44 +02:00
Ilija Tovilo d3f361c3b7 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add NEWS entries
  Fix GHSA-vc5h-9ppw-p5f3: phar circular symlink crash
  Fix SQL injection in ext-pgsql via E'...' backslash breakout
  libgd patch for CVE-2026-9672
2026-07-28 11:50:34 +02:00
Ilija Tovilo 416985389d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add NEWS entries
  Fix GHSA-vc5h-9ppw-p5f3: phar circular symlink crash
  Fix SQL injection in ext-pgsql via E'...' backslash breakout
  libgd patch for CVE-2026-9672
2026-07-28 11:41:07 +02:00
Jakub Zelenka 2e0fa0a444 Fix GHSA-vc5h-9ppw-p5f3: phar circular symlink crash
Prevents infinite recursion in phar_get_link_source.
2026-07-28 11:11:57 +02:00
Weilin Du 00f4cd6b80 Refactor various raw C-string concatenation to use existing API (#22879)
In #21607 we introduce several inline helpers for raw C-string concatenation.
This PR use them to refactor several manual C string construction.
2026-07-25 01:06:29 +08:00
Weilin Du e65a4b0f53 ext/phar: Improve various error messages (#22858)
Safe mode in phar is removed in PHP 5.4, so removing them in error messages.
Also fix some obvious typos in the error messages.
2026-07-23 18:05:22 +08:00
Gina Peter Banyard 34c686a5b4 stream: remove path parameter in stream error functions (#22792)
Instead rely on the mechanism gated by the error_include_args INI to display them.

This actually aligns the behaviour of what was accepted in https://wiki.php.net/rfc/display_error_function_args.
2026-07-19 16:15:01 +01:00
Gina Peter Banyard 9674d849eb main: convert win32_docref functions to a new function using new stream error API (#22748)
* main: move php_win32_docref{1|2}_from_error() functions and make static

Those are only used by the plain wrapper, so no need to expose them

* main: convert win32_docref functions to a new fonction using new stream error API
2026-07-16 17:04:15 +01:00
Gina Peter Banyard eaa6325959 ext/phar: remove PHAR_HDR_COMPRESSION* flags as they are unused (#22504) 2026-06-28 21:35:14 +01:00
Gina Peter Banyard 895c2af4d4 ext/phar: refactor {de}compression filter name APIs (#22502)
And clean-up usage sites as some of them shouldn't even be possible in the first place
2026-06-28 20:36:14 +01:00
Arshid c4b74d4073 ext/phar: Avoid redundant manifest hash lookup in offsetUnset() (#22437)
Replace `zend_hash_exists()` + `zend_hash_find_ptr()` with a single
`zend_hash_find_ptr()` call and a `NULL` check, avoiding an unnecessary
HashTable lookup.
2026-06-26 09:23:30 +01:00
Weilin Du 324b3baea5 Merge branch 'PHP-8.5'
* PHP-8.5:
  ext/phar: Fix .phar-prefixed non-magic directory handling (#22372)
2026-06-23 23:43:37 +08:00
Weilin Du 403bf75d83 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/phar: Fix .phar-prefixed non-magic directory handling (#22372)
2026-06-23 23:41:11 +08:00
Weilin DuandGina Peter Banyard 2a339c24d0 ext/phar: Fix .phar-prefixed non-magic directory handling (#22372)
Use a shared helper for checking whether a path refers to the magic .phar
directory. Treat .phar itself and paths below it as magic, while allowing
non-magic entries that merely use a .phar-prefixed name such as .pharx.

Apply the same check across creation, copying, ArrayAccess, stream lookup,
directory iteration, extraction, and mounts so these paths are handled
consistently.

Co-authored-by: Gina Peter Banyard <girgias@php.net>

Closes #22372
2026-06-23 23:38:42 +08:00
Weilin Du 9a6aadf0d5 ext/phar: Optimize temporary string handling in Phar directory streams (#22374)
Reduced temporary allocations when iterating Phar directories.
2026-06-22 13:07:02 +08:00