1024 Commits
Author SHA1 Message Date
Arnaud Le Blanc a2486445bd Destructor of regular arrays must be ZVAL_PTR_DTOR or NULL (#24727) 2026-10-27 16:28:34 +01:00
Jorg Sowa 0220731872 Merge branch 'PHP-8.6'
# Conflicts:
#	NEWS
2026-10-23 08:27:34 +02:00
Jorg Sowa 644b5e8896 Merge branch 'PHP-8.5' into PHP-8.6 2026-10-23 08:27:33 +02:00
Jorg Sowa 9da174f52a Merge branch 'PHP-8.4' into PHP-8.5 2026-10-23 08:27:28 +02:00
Jorg Sowa f6852befa3 ext/mbstring: fix over-read in php_mb_rfc1867_getword()
A multibyte lead byte at the end of a multipart field name made the
scan advance by the full character width past the terminating NUL,
reading out of bounds. Advance byte by byte and stop at the
terminator in both advance sites, as php_mb_rfc1867_substring_conf()
already does.

Closes GH-24498
2026-10-23 08:27:24 +02:00
Ilija Tovilo 9705fda1bb Merge branch 'PHP-8.6' into master
* PHP-8.6:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:34:56 +02:00
Ilija Tovilo d6373dfe15 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:33:23 +02:00
Ilija Tovilo c7273b9ba8 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:30:04 +02:00
Ilija Tovilo 8a94bb3822 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:27:03 +02:00
Ilija Tovilo c1a5f468d0 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:12:35 +02:00
3584a98bda Avoid state corruption via bailout
- Replace bailout on OOM with UnwindExit
- Properly reset various globals that may be accessed during startup

Fix GHSA-w8hw-w9fx-j79w (CVE-2026-109618)
Fix GHSA-6wmf-4rv5-p3rp (CVE-2026-109619)

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
Co-authored-by: Jakub Zelenka <bukka@php.net>
Co-authored-by: Nora Dossche <7771979+ndossche@users.noreply.github.com>
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
2026-10-21 16:06:22 +02:00
Kamil Tekiela 04c2058c6d Merge branch 'PHP-8.6' 2026-10-12 14:36:02 +01:00
Kamil Tekiela f9cf4fb51b Merge branch 'PHP-8.5' into PHP-8.6 2026-10-12 14:34:10 +01:00
Kamil Tekiela 8cc6af86a6 Merge branch 'PHP-8.4' into PHP-8.5 2026-10-12 14:33:25 +01:00
Kamil Tekiela 5838b68a14 ext/mbstring: Fix truncated encoding names resolving to full names (#23974)
Closes GH-23958
2026-10-12 14:26:46 +01:00
Kamil Tekiela 896653dbd2 ext/mbstring: Validate and flag UTF-8 in mb_strlen() to improve performance (#24024) 2026-09-30 18:19:43 +01:00
Weilin DuandDavid CARLIER ae62043aa3 ext/mbstring: Optimize mb_str_pad() using doubling copies (#23667)
Follow-up #23661. Use the same optimization on mb_str_pad.

Co-authored-by: David CARLIER <devnexen@gmail.com>
2026-09-13 00:04:17 +08:00
Weilin Du 063d787542 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-23106: mb_strpos() overreads truncated UTF-8 haystacks (#23107)
2026-09-12 14:32:08 +08:00
Weilin Du 35889a78d8 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-23106: mb_strpos() overreads truncated UTF-8 haystacks (#23107)
2026-09-12 14:29:29 +08:00
lazerg cc22056f9d Fix GH-23106: mb_strpos() overreads truncated UTF-8 haystacks (#23107)
offset_to_pointer_utf8() walks the haystack using the UTF-8 mblen table.
For a truncated multibyte sequence, the lead byte's table entry can exceed
the remaining bytes and leave the search start pointer past the end.

Passing that pointer to zend_memnstr() triggers an assertion in debug
builds and an out-of-bounds read in release builds, producing bogus
offsets or a crash for sufficiently long haystacks.

Clamp the pointer to the end of the string, as mb_str_split() already does
for the same table walk. Add regression coverage for forward and reverse
searches, negative offsets, and offsets beyond the haystack.

Fixes GH-23106.

Closes #23107
2026-09-12 14:27:13 +08:00
Gina Peter Banyard 7cc143235d mbstring: deprecate passing objects as vars to mb_convert_variables()
RFC: https://wiki.php.net/rfc/deprecations_php_8_6#passing_objects_for_vars_parameter_of_mb_convert_variables
2026-08-10 18:21:19 +01:00
Alex Dowad 4983e8bb44 Merge branch 'PHP-8.5' 2026-07-23 14:54:14 +09:00
Alex Dowad e0a9940134 Merge branch 'PHP-8.4' into PHP-8.5 2026-07-23 14:53:28 +09:00
Eyüp Can Akman 0d6ab5321d Fix GH-22779: mb_strrpos() wrong result in a non-UTF-8 encoding
mb_find_strpos() converts the haystack and needle to UTF-8 and does the length and offset math on the converted strings.
The negative-offset branch computed the needle length from the raw needle instead of needle_u8.
mb_fast_strlen_utf8() reads those bytes as UTF-8, so the count is wrong whenever they do not decode one to one.
A byte in 0x80-0xBF (ISO-8859-1) undercounts, and a wider encoding such as an ASCII needle in UTF-16 overcounts, so the reverse-search window is shifted.
Use needle_u8, the converted needle the rest of the branch already searches with.
2026-07-23 14:52:15 +09:00
Ilia Alshanetsky 8db6246800 Merge branch 'PHP-8.5'
* PHP-8.5:
  mbstring: Fix memory leak in mail header parsing
2026-06-11 07:42:02 -04:00
Ilia Alshanetsky d641a9f3bc Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  mbstring: Fix memory leak in mail header parsing
2026-06-11 07:40:09 -04:00
Ilia Alshanetsky 61a1b9afd6 mbstring: Fix memory leak in mail header parsing
A header field name with no value (input ending at the colon) leaves
fld_name allocated but unreleased, since the cleanup blocks only fire
when both fld_name and fld_val are set. Release the dangling fld_name in
both the loop-body and end-of-input branches.

Closes GH-22254
2026-06-11 07:38:00 -04:00
Ilija Tovilo 529b145511 Merge branch 'PHP-8.5'
* PHP-8.5:
  GHSA-m8rr-4c36-8gq4: Consistently pass unsigned char to ctype.h functions
2026-05-06 13:11:01 +02:00
Ilija Tovilo b8dad9314c GHSA-m8rr-4c36-8gq4: Consistently pass unsigned char to ctype.h functions
Fixes GHSA-m8rr-4c36-8gq4
Fixes CVE-2026-7258
2026-05-06 13:10:12 +02:00
Ilija Tovilo dc9e21b81c GHSA-m8rr-4c36-8gq4: Consistently pass unsigned char to ctype.h functions
Fixes GHSA-m8rr-4c36-8gq4
Fixes CVE-2026-7258
2026-05-06 13:09:23 +02:00
Ilija Tovilo 398b7dabfb GHSA-m8rr-4c36-8gq4: Consistently pass unsigned char to ctype.h functions
Fixes GHSA-m8rr-4c36-8gq4
Fixes CVE-2026-7258
2026-05-06 13:08:17 +02:00
Ilija Tovilo a38418777f GHSA-m8rr-4c36-8gq4: Consistently pass unsigned char to ctype.h functions
Fixes GHSA-m8rr-4c36-8gq4
Fixes CVE-2026-7258
2026-05-06 13:07:20 +02:00
tekimenandTim Düsterhus cc56225339 [RFC][mbregex] Set deprecate Oniguruma(mbregex) (#21490)
Set deprecate Oniguruma(mbregex)

Thank you for Oniguruma.

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2026-04-28 11:06:53 +09:00
Ben Ramsey f141a56a67 license-update: ext/mbstring source headers
RFC: https://wiki.php.net/rfc/php_license_update
2026-04-11 21:20:54 -05:00
Tim Düsterhus 04f06e8cf2 zend_portability: Remove EMPTY_SWITCH_DEFAULT_CASE() (#20063)
There are several issues with this macro:

- It is incorrectly named: It's not an empty default case. It's an unreachable
  default case.
- It is hiding control flow in its definition, which can be confusing for
  humans and tools (such as Coccinelle) alike, because it looks like it would
  be a statement that belongs to the "current" case rather than opening a new
  one.

Since this macro is exactly as long as explicitly spelling out its definition
(excluding the useless `break;`), it is not even making the code any more
succinct.
2026-04-06 14:46:15 +02:00
Gina Peter Banyard b621f80dce ext/mbstring: use new INI API and remove unnecessary casts (#21393) 2026-04-03 18:59:49 +01:00
Alex Dowad 115ea486ac Merge branch 'PHP-8.5' 2026-02-17 06:51:21 +09:00
Alex Dowad e106d688c2 Merge branch 'PHP-8.4' into PHP-8.5 2026-02-17 06:48:37 +09:00
Jordi Kroon 37c5a13d67 replace alloca with do_alloca in mb_guess_encoding_for_strings
This avoids a crash in cases where the list of candidate encodings is so huge
that alloca would fail. Such crashes have been observed when the list of
encodings was larger than around 208,000 entries.
2026-02-17 06:46:42 +09:00
Alex Dowad 7ad406a4b9 Fix crash in mb_substr with MacJapanese encoding
Thanks to the GitHub user vi3tL0u1s (Viet Hoang Luu) for reporting this issue.

The MacJapanese legacy text encoding has a very unusual property; it is possible for a string
to encode more codepoints than it has bytes. In some corner cases, this resulted in a situation
where the implementation code for mb_substr() would allocate a buffer of size -1. As you can
probably imagine, that doesn't end well.

Fixes GH-20832.
2026-01-18 20:07:12 +09:00
Alexandre Daubois b391c28f90 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20836: Stack overflow in mb_convert_variables with recursive array references (#20839)
2026-01-14 20:11:31 +01:00
Alexandre Daubois 32803687fe Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20836: Stack overflow in mb_convert_variables with recursive array references (#20839)
2026-01-14 20:10:30 +01:00
Alexandre Daubois 2c112e3696 Fix GH-20836: Stack overflow in mb_convert_variables with recursive array references (#20839) 2026-01-14 20:07:11 +01:00
Niels Dossche e4098da58a Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20833: mb_str_pad() divide by zero if padding string is invalid in the encoding
2026-01-05 20:01:59 +01:00
Niels Dossche 171b52c98f Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20833: mb_str_pad() divide by zero if padding string is invalid in the encoding
2026-01-05 20:01:54 +01:00
Niels Dossche 03113b09ce Fix GH-20833: mb_str_pad() divide by zero if padding string is invalid in the encoding
If the padding string is not valid in the given encoding,
mb_get_strlen() can return 0.

Closes GH-20834.
2026-01-05 20:01:25 +01:00
Gina Peter Banyard c727f4d6c5 ext/standard/mail: use zend_string* for extra_cmd param of php_mail() 2025-12-27 23:26:58 +00:00
Niels Dossche f20701416d mbstring: Transform RETURN_STR(zend_string_init_fast(...)) to RETURN_STRINGL_FAST(...) (#20779)
This is a dedicated API which is cleaner.
2025-12-26 12:15:25 +01:00
Yuya Hamada 64dd933a06 Merge branch 'PHP-8.4' into PHP-8.5 2025-12-15 10:58:49 +09:00
Yuya Hamada 355a4b5e61 Merge branch 'PHP-8.3' into PHP-8.4 2025-12-15 10:57:21 +09:00