1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 19:23:22 +02:00
Commit Graph

72162 Commits

Author SHA1 Message Date
Bob Weinand b95d2ee70a Merge branch 'PHP-8.5'
* PHP-8.5:
  Split the live-ranges of loop variables again (#20865)
2026-01-15 16:17:34 +01:00
Bob Weinand c878380065 Merge branch 'PHP-8.4' of github.com:php/php-src into PHP-8.5
* 'PHP-8.4' of github.com:php/php-src:
  Split the live-ranges of loop variables again (#20865)
2026-01-15 16:15:29 +01:00
Bob Weinand 27ed48c0be Split the live-ranges of loop variables again (#20865)
* Fix use-after-free in FE_FREE with GC interaction

When FE_FREE with ZEND_FREE_ON_RETURN frees the loop variable during
an early return from a foreach loop, the live range for the loop
variable was incorrectly extending past the FE_FREE to the normal
loop end. This caused GC to access the already-freed loop variable
when it ran after the RETURN opcode, resulting in use-after-free.

Fix by splitting the ZEND_LIVE_LOOP range when an FE_FREE with
ZEND_FREE_ON_RETURN is encountered:
- One range covers the early return path up to the FE_FREE
- A separate range covers the normal loop end FE_FREE
- Multiple early returns create multiple separate ranges

* Split the live-ranges of loop variables again

b0af9ac733 removed the live-range splitting of foreach variables, however it only added handling to ZEND_HANDLE_EXCEPTION.
This was sort-of elegant, until it was realized in 8258b7731b that it would leak the return variable, requiring some more special handling.
At some point we added live tmpvar rooting in 52cf7ab8a2, but this did not take into account already freed loop variables, which also might happen during ZEND_RETURN, which cannot be trivially accounted for, without even more complicated handling in zend_gc_*_tmpvars() functions.

This commit also proposes a simpler way of tracking the loop end in loopvar freeing ops: handle it directly during live range computation rather than during compilation, eliminating the need for opcache to handle it specifically.
Further, opcache was using live_ranges in its basic block computation in the past, which it no longer does. Thus this complication is no longer necessary and this approach should be actually simpler now.

Closes #20766.

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>

---------

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Gustavo Lopes <mail@geleia.net>
2026-01-15 16:13:43 +01:00
Steve Wall c1d2875a82 Implement GH-20310: No critical extension indication in openssl_x509_parse() output
This add criticalExtensions field to openssl_x509_parse() output that
provides name of all critical extensions.

Closes #20310
Closes #20311
2026-01-14 22:59:10 +01: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
Derick Rethans 16ca3531cf Merge branch 'PHP-8.5'
* PHP-8.5:
  Update generated parser file
2026-01-14 14:22:19 +00:00
Derick Rethans 695df88fbf Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Update generated parser file
2026-01-14 14:22:06 +00:00
Derick Rethans c929f2aa87 Update generated parser file 2026-01-14 14:21:29 +00:00
Derick Rethans 0bdfaf308b Merge branch 'PHP-8.5'
* PHP-8.5:
  Upgrade timelib to 2022.16
  Updated to version 2025.3 (2025c)
2026-01-14 14:13:33 +00:00
Derick Rethans cdeb0694f4 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Upgrade timelib to 2022.16
2026-01-14 14:12:15 +00:00
Derick Rethans 9d4a1f0c7e Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Upgrade timelib to 2022.16
2026-01-14 14:11:29 +00:00
Derick Rethans e208cd86b4 Upgrade timelib to 2022.16 2026-01-14 14:10:44 +00:00
Derick Rethans 45978c183e Updated to version 2025.3 (2025c) 2026-01-14 13:55:18 +00:00
Derick Rethans 771dbda6fb Updated to version 2025.3 (2025c) 2026-01-14 13:55:17 +00:00
Derick Rethans 65e316e89c Updated to version 2025.3 (2025c) 2026-01-14 13:55:15 +00:00
Derick Rethans 2670c8646d Updated to version 2025.3 (2025c) 2026-01-14 13:55:08 +00:00
Máté Kocsis 858d34fd32 Merge branch 'PHP-8.5'
* PHP-8.5:
  Reorganize ext/uri tests - equivalence (#20391)
2026-01-13 22:46:22 +01:00
Máté Kocsis 48344c9f86 Reorganize ext/uri tests - equivalence (#20391) 2026-01-13 22:45:58 +01:00
Niels Dossche d86182f7ef date: Avoid passing objects using double pointers
Using single pointers is cleaner and also generates better machine code.
2026-01-13 18:53:43 +01:00
Niels Dossche 3c654a8574 date: Remove unused argument for internal functions 2026-01-13 18:53:43 +01:00
Tim Düsterhus 175b7bca8c Merge branch 'PHP-8.5'
* PHP-8.5:
  zend_language_parser: Backup / restore doc comment when parsing attributes (#20896)
2026-01-13 16:08:15 +01:00
Tim Düsterhus 11ae6ad0be zend_language_parser: Backup / restore doc comment when parsing attributes (#20896)
Attributes may themselves contain elements which can have a doc comment on
their own (namely Closures). A doc comment before the attribute list is
generally understood as belonging to the symbol having the attributes.

Fixes php/php-src#20895.
2026-01-13 16:07:50 +01:00
Arnaud Le Blanc 0a90dd6f92 Merge branch 'PHP-8.5'
* PHP-8.5:
  NEWS
  Set default_object_handlers when registering internal enums
2026-01-13 12:36:50 +01:00
Arnaud Le Blanc cc21f5e095 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  NEWS
  Set default_object_handlers when registering internal enums
2026-01-13 12:36:31 +01:00
Arnaud Le Blanc 075b6b85f6 Set default_object_handlers when registering internal enums
Internal enums can be cloned and compared, unlike user enums, because we didn't set default_object_handlers when registering internal enums.

Fix by setting default_object_handlers when registering internal enums.

Fixes GH-20914
Closes GH-20915
2026-01-13 12:32:52 +01:00
Alex Dowad c34b84ed81 Remove unused conversion code from mbstring
Over the last few years, I refactored mbstring to perform encoding conversion
a buffer at a time, rather than a single byte at a time. This resulted in a
huge performance increase.

After the refactoring, the old "byte-at-a-time" code was retained for two
reasons:

1) It was used by the mailparse PECL extension.
2) It was used to implement mb_strcut for some text encodings.

However, after reviewing mailparse's use of mbstring, it is clear that
mailparse only relies on mbstring for decoding of QPrint, and possibly
Base64. It does not use the byte-at-a-time conversion code for any
other encoding.

Further, mb_strcut only relies on the byte-at-a-time conversion code
for a limited number of legacy text encodings, such as ISO-2022-JP,
HZ, UTF-7, etc.

Hence, we can remove over 5000 lines of unused code without breaking
anything. This will help to reduce binary size, and make the mbstring
codebase easier to navigate for new contributors.
2026-01-13 11:43:44 +09:00
Alex Dowad 11bec6b92f Remove some now-unused code from mbfl_strcut
The legacy mbfl_strcut function is only used to implement mb_strcut
for legacy text encodings which 1) do not use a fixed number of bytes
per codepoint, 2) do not have an 'mblen_table' which can be used to
quickly determine the codepoint length of a byte sequence, and 3) do
not have a specialized 'mb_cut' function which implements mb_strcut
for that text encoding.

Remove unused code from mbfl_strcut, and leave only what is currently
needed for the implementation of mb_strcut.
2026-01-13 11:43:44 +09:00
Niels Dossche 91f095d2ff Merge branch 'PHP-8.5'
* PHP-8.5:
  Add test for GH-20880 (#20919)
2026-01-12 22:45:50 +01:00
Niels Dossche c80ac797d4 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Add test for GH-20880 (#20919)
2026-01-12 22:45:43 +01:00
Niels Dossche 1052270001 Add test for GH-20880 (#20919)
Closes GH-20880.
2026-01-12 22:45:24 +01:00
Dmitry Stogov 9d089a8d30 Merge branch 'PHP-8.5'
* PHP-8.5:
  Update IR (#20916)
2026-01-12 21:24:04 +03:00
Dmitry Stogov f7f0d228c2 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Update IR (#20916)
2026-01-12 21:23:52 +03:00
Dmitry Stogov 098b1f89bd Update IR (#20916)
IR commit: 40cd6ad28c376cf006c360f39d8aeff6d6e7bf78
2026-01-12 21:23:38 +03:00
Niels Dossche 4e76b9a145 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix bug52820 test for new libcurl release
2026-01-12 18:48:03 +01:00
Niels Dossche acad49cace Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix bug52820 test for new libcurl release
2026-01-12 18:47:57 +01:00
Niels Dossche 290ebf13e1 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix bug52820 test for new libcurl release
2026-01-12 18:47:51 +01:00
Niels Dossche 39da78f422 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bug52820 test for new libcurl release
2026-01-12 18:47:45 +01:00
Niels Dossche 636f84adcf Fix bug52820 test for new libcurl release
Reference: GH-20910.
2026-01-12 18:47:33 +01:00
Jordi Kroon cdd5aa21d8 Fix dateformat_format_variant3 test and split into different files (#20901) 2026-01-12 05:07:02 +00:00
Niels Dossche d8d754fc31 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20856: heap-use-after-free in SplDoublyLinkedList iterator when modifying during iteration
2026-01-11 20:43:19 +01:00
Niels Dossche a82a93d64e Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20856: heap-use-after-free in SplDoublyLinkedList iterator when modifying during iteration
2026-01-11 20:43:12 +01:00
Niels Dossche 2a2e0e8128 Fix GH-20856: heap-use-after-free in SplDoublyLinkedList iterator when modifying during iteration
The element may be still in use in other places, so the linking pointers
should be kept consistent. If not consistent, the "move forward" code in
the sample test will read a stale, dangling pointer.

Closes GH-20885.
2026-01-11 20:42:25 +01:00
Niels Dossche c434e046bc Remove LIBXML_XINCLUDE option from valid list of XMLDocument (#20907)
This option is only valid for pull parsers.
2026-01-11 20:38:03 +01:00
Niels Dossche 9b0643ea36 spl: Remove unused fields from spl dllist (#20886) 2026-01-11 15:08:31 +01:00
Ilija Tovilo 1ee38a3dcb Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix block_pass JMP[N]Z optimization
2026-01-11 14:56:11 +01:00
Ilija Tovilo 918dc2355e Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix block_pass JMP[N]Z optimization
2026-01-11 14:56:05 +01:00
Ilija Tovilo f61b1fc036 Fix block_pass JMP[N]Z optimization
In the following optimization:

JMPZ(X,L1) JMP(L2) L1: -> JMPNZ(X,L2) NOP

L1 must not be followed by another block, so that it may safely be followed by
the block containing the JMPNZ. get_next_block() is used to verify L1 is the
direct follower. This function also skips empty blocks, including live, empty
target blocks, which will then implicitly follow the new follow block. This will
result in L1 being followed by two separate blocks, which is not possible.

Resolve this by get_next_block() stopping at target blocks.

Fixes OSS-Fuzz #472563272
Closes GH-20850
2026-01-11 14:55:23 +01:00
Niels Dossche 9ab800ec9b Mark Phar::buildFromIterator() base directory argument as a path
This is like buildFromDirectory() which does it right.

Closes GH-20892.
2026-01-11 12:27:36 +01:00