Commit graph

135836 commits

Author SHA1 Message Date
Ilija Tovilo
347723af05
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Add timeout for FreeBSD
2025-08-12 14:18:53 +02:00
Ilija Tovilo
0c044b35b7
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Add timeout for FreeBSD
2025-08-12 14:18:44 +02:00
Ilija Tovilo
abb7f2879e
[skip ci] Add timeout for FreeBSD
Unfortunately, these jobs routinely fail to boot correctly. In this case,
they'll stall and block CI for 6 hours until they finally fail. Add a limit to
make them fail earlier.
2025-08-12 14:17:33 +02:00
Niels Dossche
9b86533ce4
Fix GH-19065: Long match statement can segfault compiler during recursive SSA renaming
On some systems, like Alpine, the thread stack size is small by default.
The last step of SSA construction involves variable renaming that is
recursive, and also makes copies of their version of the renamed
variables on the stack. This combination causes a stack overflow during
compilation on Alpine. Triggerable for example with very long match
statements.

A stop-gap solution would be to use heap allocated arrays for the
renamed variable list, but that would only delay the error as increasing
the number of match arms increases the depth of the dominator tree, and
will eventually run into the same issue.

This patch transforms the algorithm into an iterative one.
There are two states stored in a worklist stack: positive numbers
indicate that the block still needs to undergo variable renaming.
Negative numbers indicate that the block and its dominated children are
already renamed. Because 0 is also a valid block number, we bias the
block numbers by adding 1.
To restore to the right variant when backtracking the "recursive" step,
we index into an array pointing to the different variable renaming
variants.

Closes GH-19083.
2025-08-11 23:05:21 +02:00
Niels Dossche
b57578f3b1
Fix GH-19383: php-8.3.24: Missing type in function definition: fpm_event_kqueue_clean
This is just a clean backport.
2025-08-10 13:25:24 +02:00
Jakub Zelenka
9e2aa658a8
Fix GH-19428: openssl_pkey_derive segfaults for DH derive with low key_length
This happens only for OpenSSL 1.1.1 because key_length is ignored for
DH. It means that the provided string is overwritten with longer buffer.
2025-08-09 17:43:04 +02:00
Niels Dossche
cc93bbb765
Fix GH-19397: mb_list_encodings() can cause crashes on shutdown
The request shutdown does not necessarily hold the last reference, if
there is still a CV that refers to the array.

Closes GH-19405.
2025-08-08 20:32:29 +02:00
Niels Dossche
5cf45ba5ab
Fix GH-19371: integer overflow in calendar.c
Closes GH-19380.
2025-08-07 19:08:32 +02:00
Ilija Tovilo
aae35f3617
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix ERROR_CODE handling in COMMUNITY build
2025-08-07 13:56:06 +02:00
Ilija Tovilo
080ba20d49
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix ERROR_CODE handling in COMMUNITY build
2025-08-07 13:55:59 +02:00
Ilija Tovilo
2cd9233e42
Fix ERROR_CODE handling in COMMUNITY build
We need || because a non-0 return from the application aborts the execution of
the job.
2025-08-07 13:54:55 +02:00
David Carlier
bd2766ce79
zend call stack fixing stack limit for macOs arm64.
8MB sounded a prudent size for older 10.9 macOs release, however
with newer mac with arm64, it triggers a stack overflow.

Cherry picks b320aabc5e (GH-13319) from PHP-8.4.
Closes GH-19390.
2025-08-07 08:38:40 +02:00
Ilija Tovilo
44618752f9
[skip ci] Bump retries in benchmark diff when looking for benchmarked commits 2025-08-06 22:28:56 +02:00
Ilija Tovilo
3aa4209ef6
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Fix Symfony COMMUNITY build for new phpunit version
2025-08-06 15:10:07 +02:00
Ilija Tovilo
a8cea0c09b
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Fix Symfony COMMUNITY build for new phpunit version
2025-08-06 15:10:01 +02:00
Ilija Tovilo
0ac37fb74d
[skip ci] Fix Symfony COMMUNITY build for new phpunit version
--exclude-group no longer accepts a comma-separated list. Doc block comments are
no longer supported, switch to attributes.
2025-08-06 15:07:45 +02:00
Ilija Tovilo
5be04e25fd
[skip ci] Skip segfaulting OOM test in GH actions on Win
This only fails on the PHP-8.3 branch, most likely to be related to the
environment as discussed with Niels.
2025-08-06 14:28:47 +02:00
Ilija Tovilo
bf6a74d2f9
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  COMMUNTIY build grouping adjustments
2025-08-06 14:20:26 +02:00
Ilija Tovilo
9cbc09d189
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  COMMUNTIY build grouping adjustments
2025-08-06 14:20:17 +02:00
Ilija Tovilo
a63e97667e
COMMUNTIY build grouping adjustments
Unconditionally execute assignment of EXIT_CODE. Otherwise, the variable bleeds
into the next iteration. Also add newline before ::endgroup::. ASAN does not add
a trailing newline.
2025-08-06 14:18:43 +02:00
Ilija Tovilo
c286cb8a1e
[skip ci] Add fuzzer binaries to .gitignore 2025-08-06 14:00:44 +02:00
Shivam Mathur
f08ac4f1c9 Merge branch 'PHP-8.2' into PHP-8.3 2025-08-06 00:04:58 +00:00
Shivam Mathur
871de14ceb Merge branch 'PHP-8.1' into PHP-8.2 2025-08-06 00:03:49 +00:00
Shivam Mathur
8199cad99f
Fix master branch check in find-target-branch.bat (#19385) 2025-08-06 05:32:36 +05:30
Ilija Tovilo
cdfd663266
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Group component output in community job
2025-08-05 15:44:07 +02:00
Ilija Tovilo
dde094a442
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Group component output in community job
2025-08-05 15:43:58 +02:00
Ilija Tovilo
1c65cc3998
[skip ci] Group component output in community job 2025-08-05 15:43:46 +02:00
Ilija Tovilo
bfd42b060d
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Add zend_jit_arm64.c to gitignore
2025-08-04 23:12:22 +02:00
Ilija Tovilo
f077c9d233
[skip ci] Add zend_jit_arm64.c to gitignore
This is not generated in CI since moving to macOS 14, which is arm based.
2025-08-04 23:12:09 +02:00
Ilija Tovilo
234159d911
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Upgrade to macOS 14 and backport necessary changes
2025-08-04 22:20:06 +02:00
Ilija Tovilo
7ba4453f8f
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Upgrade to macOS 14 and backport necessary changes
2025-08-04 22:19:59 +02:00
Ilija Tovilo
e9e432a35d
Upgrade to macOS 14 and backport necessary changes 2025-08-04 22:12:30 +02:00
Arndt Kaiser
9d29283392
Fix filtering of INI directives to respect leading whitespaces
Directives are now correctly filtered out if the line in the php.ini
file begins with whitespace characters.

Closes GH-19348
2025-08-04 16:55:46 +02:00
Ilija Tovilo
d0fad34230
Fix circumvented type check with return by ref + finally
Fixes GH-18736
Closes GH-19172
2025-08-01 00:35:48 +02:00
Niels Dossche
a96b05e63f
Fix GH-19300: Nested array_multisort invocation with error breaks
There are 2 issues:
1. When a MULTISORT_ABORT happens, it frees func, but func may point to
   ARRAYG(multisort_func), which would be a problem with nested
   invocations as it can destroy that of the "parent" invocation.
   To solve this, delay assigning to the globals.
2. The old globals were not restored which means that nested invocations
   with different flags will cause a wrong sorting function to be used.

Closes GH-19319.
2025-07-31 19:00:45 +02:00
Arnaud Le Blanc
6fa8a25a40
Prevent throwing in running generator
Generator::throw() on a running generator is not allowed. It throws "Cannot
resume an already running generator" when trying to resume the generator to
handle the provided exception.

However, when calling Generator::throw() on a generator with a non-Generator
delegate, we release the delegate regardless. If a Fiber was suspended in
the delegate, this causes use after frees when the Fiber is resumed.

Fix this by throwing "Cannot resume an already running generator" earlier.

Fixes GH-19326
Closes GH-19327
2025-07-31 14:26:41 +02:00
Arnaud Le Blanc
0406a55c92
Prevent resumption of generator suspended in yield from
Normally we prevent generators from being resumed while they are already
running, but we failed to do so for generators delegating to non-Generators. As
a result such generator can be resumed, terminated, which causes unexpected
results (crashes) later.

In gh19306.phpt in particular, the generator delegate It::getIterator() suspends
while being called by generator g(). We then resume g(), which throws while
trying to resume It::getIterator(). This causes g() and It::getIterator()
to be released. We then UAF when resuming the Fiber in It::getIterator().

Fix this by ensuring that generators are marked as running while they fetch
the next value from the delegate.

Fixes GH-19306
Closes GH-19315
2025-07-31 08:45:19 +02:00
Niels Dossche
5bd5f352e5
Fix GH-19303: Unpacking empty packed array into uninitialized array causes assertion failure
Having an empty result array is not a problem, because zend_hash_extend()
will initialize it. Except it does not when the number of elements to add
equals 0, which leaves the array uninitialized and therefore does not
set the packed flag, causing the assertion failure.

Technically, removing the assert would also work and save a check.
On the other hand, this check could also prevent some real work to be
done and should be relatively cheap as we already have to compute the
sum anyway.

Closes GH-19318.
2025-07-30 22:47:11 +02:00
Arnaud Le Blanc
bc4b6ce7a8
Prevent operands from being released during comparison
Fixes GH-19305
Closes GH-19309
2025-07-30 18:09:24 +02:00
Ilija Tovilo
80022c035b
Fix failed assertion with throwing __toString in binary const expr
Solve this with the same pattern as ZEND_AST_GREATER[_EQUAL].

Fixes OSS-Fuzz #434346548
Closes GH-19291
2025-07-30 13:34:01 +02:00
Niels Dossche
be9f1d3d56
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Reset global pointers to prevent use-after-free
2025-07-30 09:23:12 +02:00
Niels Dossche
7016ad558b
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Reset global pointers to prevent use-after-free
2025-07-30 09:22:50 +02:00
Florian Engelhardt
3aaa8d3526
Reset global pointers to prevent use-after-free
Closes GH-19212.
2025-07-30 09:22:15 +02:00
Gina Peter Banyard
6b0a80903b
ext/intl: Fix return value on failure for resourcebundle count handler
Closes GH-19277
2025-07-28 15:35:31 +01:00
Gina Peter Banyard
83b8d2c290
ext/gd: Fix comparison with result of php_stream_can_cast()
Closes GH-19107
2025-07-28 11:54:19 +01:00
Peter Kokot
17df11e3f7
Fix bug #51558: shared readline build fails (#15242)
The 'rl_pending_input' is a variable in Readline library and checking it
with PHP_CHECK_LIBRARY wouldn't find it on some systems.

Library check works on most systems but not on the mentioned AIX in the
bug as it exports variables and functions differently whereas the linker
couldn't resolve the variable as a function.

This should fix the build on systems where this caused issues, such as
AIX.

The <readline/readline.h> is not self-contained header and needs to also
have <stdio.h> included before to have FILE type available. This fixes
the issue on unpatched default readline installations, such as macOS.

Checking this variable ensures that the found library is the correct
library and also that it is of minimum version needed by current PHP
code (https://bugs.php.net/48608).

The library check:

```c
| char rl_pending_input ();
| int main (void) {
|     return rl_pending_input ();
| }
```

The declaration check:

```c
| #include <stdio.h>
| #include <readline/readline.h>
| int main (void) {
| #ifndef rl_pending_input
| #ifdef __cplusplus
|     (void) rl_pending_input;
| #else
|     (void) rl_pending_input;
| #endif
| #endif
| ;
|     return 0;
| }
```

Closes https://bugs.php.net/51558

Closes GH-19259.
2025-07-27 15:33:48 +02:00
David Carlier
e1c4a0ae51
Fixed GH-19261: msgfmt_parse_message leaks on message format failure.
close GH-19262
2025-07-27 13:49:24 +01:00
dixyes
e16df981bf
ext/pdo_pgsql: Fix _pdo_pgsql_trim_message bad access
close GH-19239
2025-07-27 12:54:43 +01:00
dixyes
5dd965117a
Free opened_path when opened_path_len >= MAXPATHLEN
Closes GH-19240.
2025-07-27 10:54:21 +02:00
Arnaud Le Blanc
a7cdf0b172
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add unique entry point for extra tests
2025-07-26 16:15:48 +02:00