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

6025 Commits

Author SHA1 Message Date
Jakub Zelenka
04023e5e72 Remove XFAIL for proc-idle-timeout.phpt 2026-03-07 13:11:37 +01:00
Jakub Zelenka
71a01794cc Add back FPM_RUN_RESOURCE_HEAVY_TESTS 2026-03-07 13:05:32 +01:00
Ilija Tovilo
3902f843f7 [skip ci] Mark sapi/fpm/tests/proc-idle-timeout.phpt as XFAIL
This test fails all the time. It should be improved.
2026-03-07 12:41:52 +01:00
Ilija Tovilo
3a57b4ced5 Add RUN_RESOURCE_HEAVY_TESTS env var
Disable resource-heavy tests by default (>1GB of memory usage), unless the
RUN_RESOURCE_HEAVY_TESTS env variable is set.

Fixes GH-20762
Closes GH-20935
2026-02-27 15:00:35 +01:00
Niels Dossche
4d28e2af9e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  sapi/fpm: remove use of variable-length arrays (#10645)
2025-12-14 23:30:54 +01:00
Max Kellermann
5850c7de7c sapi/fpm: remove use of variable-length arrays (#10645)
According to @cmb69, PHP does not require VLA support
(https://github.com/php/php-src/pull/10304#discussion_r1069343092).
VLAs are a bad idea for several reasons, so let's get rid of them.

Two of the VLAs were probably unintended; unlike C++, C doesn't have
the concept of "constant expressions", so an array with a "const"
length is technically still a VLA.  This is fixed by removing the
"const" variable, and using sizeof() instead.

(cherry picked from commit ff2a211d55)
2025-12-14 23:30:37 +01:00
Ilija Tovilo
b9eaee18e4 [skip ci] Skip fpm tests crashing lsan on GHA
> LeakSanitizer has encountered a fatal error.

This happens only on 8.2/8.3 for some reason. Don't merge for 8.4 for now, we
can do that later if it reoccurs.
2025-11-05 13:22:44 +01:00
Ilija Tovilo
413c73153d Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Fix typo
2025-10-17 13:22:32 +02:00
Ilija Tovilo
d62f70c6de [skip ci] Fix typo
Should've been skip, not flaky...
2025-10-17 13:21:49 +02:00
Ilija Tovilo
2b0763148d Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Skip suspicious fpm tests on GH actions & macOS
2025-10-17 13:17:25 +02:00
Ilija Tovilo
b094d5a588 [skip ci] Skip suspicious fpm tests on GH actions & macOS
There have been misterious macOS failures with the following error for a long
time, which would usually happen 1-2x per nightly run:

> The hosted runner lost communication with the server. Anything in your
> workflow that terminates the runner process, starves it for CPU/Memory, or
> blocks its network access can cause this error.

After way too much debugging, it looks like this is caused by the two fpm tests
skipped in this commit. When there's a failure, the responsible test will run
for at least 120 seconds until the job is eventually killed by GitHub Actions.
It's not clear yet why the tests stall.

Debugging this is a PITA because the GitHub Actions log gets partially lost for
killed jobs. It took an external log server to actually figure out where the job
fails. Let's disable the tests first to be sure this actually solves the issue.
2025-10-17 13:04:11 +02:00
Jakub Zelenka
6f92e9c054 Merge branch 'PHP-8.1' into PHP-8.2 2025-09-09 21:58:37 +02:00
Jakub Zelenka
c0f8bb6622 Revert "fix pipe detection for STDERR."
This reverts commit a757f276f9.
2025-09-09 21:57:54 +02:00
George Wang
828080146b fix pipe detection for STDERR. 2025-09-06 12:39:53 -04:00
George Wang
a757f276f9 fix pipe detection for STDERR. 2025-09-06 12:38:13 -04:00
Niels Dossche
97b03186c4 Fix GH-15208: Segfault with breakpoint map and phpdbg_clear()
It crashes because it's gonna try accessing the breakpoint which was cleared
by user code in `phpdbg_clear();`. Not all breakpoint data was properly
cleaned.

Closes GH-16953.
2024-11-26 22:26:37 +01:00
Niels Dossche
f18d429b20 Fix GHSA-4w77-75f9-2c8w 2024-11-20 11:07:28 +01:00
Niels Dossche
7dd336ae83 Fix GHSA-4w77-75f9-2c8w 2024-11-18 11:06:01 +01:00
Jakub Zelenka
065bde1e13 Fix GH-16432: PHP-FPM 8.2 SIGSEGV in fpm_get_status 2024-11-08 16:44:05 +01:00
Niels Dossche
3f1ea1b663 Fix test with shared zend_test (#16705) 2024-11-05 21:35:47 +01:00
Niels Dossche
e643129bbb Fix GH-16628: FPM logs are getting corrupted with this log statement
zlog_buf_prefix() can return a larger length than what actually was
written due to its use of snprintf(). The code in
zlog_stream_prefix_ex() does not take this into account, other callers
do. What ends up happening then is that stream->length is set to the
length as if snprintf() was able to write all bytes, causing
stream->length to become larger than stream->buf.size, causing a
segfault.

In case the buffer was too small we try with a larger buffer up to a
limit of zlog_limit. This makes sure that the stream length will remain
bounded by the buffer size.

This also adds assertions to make the programmer intent clear and catch
this more easily in debug builds.

Closes GH-16680.
2024-11-02 19:36:20 +01:00
Ilija Tovilo
06efe44c2e Skip shebang in cli-server router script
Fixes GH-16373
Closes GH-16403
2024-10-14 13:33:16 +02:00
Christoph M. Becker
6bcba24eb0 Fix GH-16174: Empty string is an invalid expression for phpdbg-ev
Strings may be empty, so we must not assume they are not.

Closes GH-16177.
2024-10-10 01:45:37 +02:00
Jakub Zelenka
5a47f27021 Fix GH-15395: php-fpm: zend_mm_heap corrupted with cgi-fcgi request
Closes GH-16227

Co-authored-by: David Carlier <devnexen@gmail.com>
2024-10-06 19:37:55 +01:00
David Carlier
3d80d98a10 Fix GH-16137: "Deduplicate" http headers values but Set-Cookie.
Those are meant to have 1 or plus values separated by a comma even
 if the client set them separately.

close GH-16154
2024-10-03 22:45:31 +01:00
Christoph M. Becker
f14e5cfaaa Fix GH-16181: phpdbg: exit in exception handler reports fatal error
When running PHP code, we must not handle `UnwindExit` exceptions, but
rather have to ignore them.

Closes GH-16182.
2024-10-03 11:36:13 +02:00
Ilija Tovilo
706bcdbc1a Fix printing backtrace of fake generator frame
Fixes GH-15851
Closes GH-15952
2024-09-27 17:34:51 +02:00
Ben Ramsey
c259c9f3f6 Merge branch 'PHP-8.1' into PHP-8.2 2024-09-26 13:13:46 -05:00
Jakub Zelenka
4580b8b3e1 Fix GHSA-865w-9rf3-2wh5: FPM: Logs from childrens may be altered 2024-09-23 11:24:35 +01:00
Niels Dossche
c1c14c8a0f Fix GHSA-94p6-54jq-9mwp
Apache only generates REDIRECT_STATUS, so explicitly check for that
if the server name is Apache, don't allow other variable names.
Furthermore, redirect.so and Netscape no longer exist, so
remove those entries as we can't check their server name anymore.

We now also check for the configuration override *first* such that it
always take precedence. This would allow for a mitigation path if
something like this happens in the future.
2024-09-23 11:24:26 +01:00
Niels Dossche
4b9cd27ff5 Fix GHSA-p99j-rfp4-xqvq
It's no use trying to work around whatever the operating system and Apache
do because we'll be fighting that until eternity.
Change the skip_getopt condition such that when we're running in
CGI or FastCGI mode we always skip the argument parsing.
This is a BC break, but this seems to be the only way to get rid of this
class of issues.
2024-09-23 11:24:19 +01:00
Christoph M. Becker
422aa17b9b Fix GH-15901: phpdbg: Assertion failure on i funcs
New hash tables are not automatically packed, so we must not treat them
as such.  Therefore we guard the foreach appropriately.

Closes GH-15929.
2024-09-18 23:48:31 +02:00
Niels Dossche
4d71580e00 Add necessary SKIPIFs to new phpdbg tests
Similarly to other watchpoint tests, we add SKIPIFs.
These TRACKED_ALLOC issues should be investigated though [1] [2].

[1] de5c760c69 (comments)
[2] https://github.com/php/php-src/pull/15229#pullrequestreview-2230563480
2024-08-10 01:10:01 +02:00
Niels Dossche
2e26559fcd Fix uninitialized value watchpoint_hit
Closes GH-15317.
2024-08-09 23:46:16 +02:00
David Carlier
9aeb6761b5 Fix GH-15210: phpdbg_print_changed_zvals working on a real copy instead.
Close GH-15229
2024-08-09 21:12:11 +01:00
Niels Dossche
a6c547d1dd Fix GH-15268: heap buffer overflow in phpdbg (zend_hash_num_elements() Zend/zend_hash.h)
The class is not yet linked, so we cannot access `parent`, but only
`parent_name`.

Closes GH-15277.
2024-08-08 20:35:20 +02:00
Peter Kokot
dc670cb7f6 Fix GH-13199: Redundant prompt in phpdbg with libedit/readline
When using libedit/readline integration in phpdbg:

    ./configure --with-libedit --enable-phpdbg-readline

EOF makes editline write prompt again in local console mode. For
example, this can be noticed when reading phpt test files from STDIN and
running phpdbg:

    ./sapi/cli/php run-tests.php sapi/phpdbg

Closes GH-13199
2024-08-02 08:33:57 +02:00
Niels Dossche
95889979f2 Fix GH-14553: Bug in phpdbg8.3 (also 8.1 and 8.2) echo output - trimmed at NULL byte (?)
This broke in 6318040df2 when phpdbg
stopped using its custom printing routines. By relying on standard
printing routines, the embedded NUL bytes are causing the strings to be
cut off, even when using %.*s. Solve this by going straight to the
output routine, which is what the printf routine would've done anyway.

Closes GH-14822.
2024-07-04 18:43:42 +02:00
David Carlier
6704c60589 Fix GH-14596: phpdbg with asan and ZC_RC_DEBUG set crashes.
close GH-14607
2024-06-21 05:02:53 +01:00
David Carlier
03f0776d08 Fix GH-13681: segfault when adding watchpoint fails.
thus when removing its entry, no watch point is set and crash on
pointer access.

close GH-14513
2024-06-17 17:45:53 +01:00
Wilhansen Li
43bc53a730 Fix GH-14037: Make /ping of php-fpm work with pm.status_listen pool
The ping feature of php-fpm monitoring was previously not working
in pm.status_listen pool due to the configuration variables ping.path
and ping.response not being copied over to the worker when forked. This
results in the ping code path being disabled because the worker detects
that ping.path is not configured.

Closes GH-13980

Co-authored-by: Pierrick Charron <pierrick@php.net>
2024-06-16 12:22:21 +01:00
Ben Ramsey
8aff5b49c3 Merge branch 'PHP-8.1' into PHP-8.2 2024-06-05 01:10:47 -05:00
Niels Dossche
9382673148 Fix GHSA-3qgc-jrrr-25jv
The original code is error-prone due to the "best fit mapping" that
happens with the argument parsing but not with the query string.
When we get a non-ASCII character, try to remap it and see if it becomes
a hyphen.

An alternative approach is to create a custom main `wmain` receiving
wide-character variations that does the ANSI transformation with the
best-fit mapping, but that's more error-prone and could cause unexpected
breakage.

Another alternative was just don't doing this check altogether and
always check for `cgi || fastcgi` instead, but that breaks real-world
use-cases.
2024-06-05 00:29:19 -05:00
Benjamin Cremer
5b6cda6523 Fix GH-14175: Use two digit float specifier for FPM systemd format req rate
Close GH-14175
2024-05-12 13:30:29 +01:00
Niels Dossche
217b753a3d Fix GH-14189: PHP Interactive shell input state incorrectly handles quoted heredoc literals.
Only `'` was handled, no handling case for `"` existed. Simply add it so
the heredoc tag is set up correctly.

Closes GH-14195.
2024-05-10 16:48:26 +02:00
David Carlier
74843947f4 sapi/cgi: fix buffer limit on windows.
MSDN recommends dropping the deprecated `read` in favor of `_read`.
Also, the buffer size limit is INT_MAX.

Close GH-14022
2024-05-01 13:58:53 +01:00
Niels Dossche
093d334684 Fix GH-13978: Fuzzer readme still mentions obsolete --enable-json flag (#13983)
[ci skip]
2024-04-16 22:16:51 +02:00
Niels Dossche
c3acfb1b57 Fix GH-13931: Applying zero offset to null pointer in Zend/zend_opcode.c
In the test cases, the compiler bails out due to a fatal error.
The data structures used by the compiler will contain stale values.
In particular, for the test case CG(loop_var_stack) will contain data.
The next compilation will incorrectly use elements from the previous
stack.
To solve this, we reset part of the compiler data structures.
We don't do a full re-initialization via init_compiler() because that will
also reset streams and resources.

Closes GH-13938.
2024-04-15 19:39:05 +02:00
Ilija Tovilo
97162e92be Fix opcache dump varying tmps 2024-04-05 14:11:41 +02:00
Jakub Zelenka
9b1d2e93b8 Fix FPM tester default env vars change
This broke cloexec test
2024-03-30 14:37:54 +00:00