Commit graph

6192 commits

Author SHA1 Message Date
Jakub Zelenka
e48ceb0026
Fix GH-17643: FPM with httpd ProxyPass encoded PATH_INFO env
Closes GH-17644
2025-02-08 12:05:25 +01:00
ndossche
62bbfdebaa
Fix memory leak in phpdbg calling registered function
Closes GH-17635.
2025-01-30 19:28:26 +01:00
ndossche
5447473785
Partially fix GH-17387
The length of the string should be set to the truncated length (that was
used to duplicate the input anyway).
2025-01-30 19:28:23 +01:00
Niels Dossche
1235c74828
Fix crashes in function registration + test
Internal function won't need their refcount increased as they outlive
the debugger session, and userland functions won't be unloaded either.
So no refcount management is necessary for registered functions.
2025-01-06 21:30:34 +01:00
Niels Dossche
847d1401a0
Fix GH-17208: bug64539-status-json-encoding.phpt fail on 32-bits
The reason this breaks is because of a type mismatch.
The following line uses fields of the timeval struct which are both 8 bytes on
Alpine 32-bit, which results in a computed value of also 8 bytes:
b09ed9a0f2/sapi/fpm/fpm/fpm_status.c (L611)

However, it is passed to a format string which expects 4 bytes
(`unsigned long` and thus the `%lu` format specifier is 4 bytes on Alpine 32-bit),
resulting in argument corruption.
Since the value is generally small, truncating to 4 bytes is sufficient to fix this.

Closes GH-17286.
2024-12-27 21:48:15 +01:00
Kévin Dunglas
a24eada99b
[ci skip] Make build command for program using embed portable
Closes GH-17247.
2024-12-24 14:37:44 +01:00
Christoph M. Becker
fcbfd5a680
Include relevant system headers before defining fallbacks
Otherwise we may define the fallbacks, and later inclusion of the
system headers may attempt to redefine those.

Fixes GH-17112.
Closes GH-17129.
2024-12-22 16:27:01 +01:00
Jakub Zelenka
e0b79cdc5c
Introduce FPM_TEST_DEBUG_FILTER env var and extend multi request tracing 2024-12-22 14:15:03 +01:00
Jakub Zelenka
3490ac0cb3
Fix GH-13437: FPM: ERROR: scoreboard: failed to lock (already locked)
This changes locking for scoreboard to reduce contention between readers
and adds retries for acquiring scoreboard for read.

Closes GH-15805
2024-12-14 14:59:56 +01:00
Niels Dossche
3c3ec0e61a
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15208: Segfault with breakpoint map and phpdbg_clear()
2024-11-26 22:27:06 +01: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
Jakub Zelenka
ffff27f734
Merge branch 'PHP-8.2' into PHP-8.3 2024-11-20 11:12:19 +01:00
Niels Dossche
f18d429b20
Fix GHSA-4w77-75f9-2c8w 2024-11-20 11:07:28 +01:00
Jakub Zelenka
af8ebb12ca
Merge branch 'PHP-8.2' into PHP-8.3 2024-11-08 16:48:25 +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
9a255b384f
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix test with shared zend_test (#16705)
2024-11-05 21:36:41 +01:00
Niels Dossche
3f1ea1b663
Fix test with shared zend_test (#16705) 2024-11-05 21:35:47 +01:00
Niels Dossche
16cda10650
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16628: FPM logs are getting corrupted with this log statement
  Fix GH-16601: Memory leak in Reflection constructors
2024-11-02 19:37:28 +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
77f770871b
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Skip shebang in cli-server router script
2024-10-14 13:34:21 +02: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
5c6fc09e45
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16174: Empty string is an invalid expression for phpdbg-ev
2024-10-10 01:46:30 +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
59816b9a73
Merge branch 'PHP-8.2' into PHP-8.3 2024-10-06 19:40:24 +01: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
4b7a906d57
Merge branch 'PHP-8.2' into PHP-8.3 2024-10-03 22:45:51 +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
95c97c81b7
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16181: phpdbg: exit in exception handler reports fatal error
2024-10-03 11:37:15 +02: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
8c556b211d
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix printing backtrace of fake generator frame
2024-09-27 17:35:55 +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
6d99ccc268
Merge branch 'PHP-8.2' into PHP-8.3 2024-09-26 14:13:00 -05: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
c76913fde0
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15901: phpdbg: Assertion failure on `i funcs`
2024-09-18 23:50:20 +02: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
04adeeaef8
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add necessary SKIPIFs to new phpdbg tests
2024-08-10 01:11:09 +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
76dae3d0e3
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix uninitialized value watchpoint_hit
2024-08-09 23:46:30 +02:00
Niels Dossche
2e26559fcd
Fix uninitialized value watchpoint_hit
Closes GH-15317.
2024-08-09 23:46:16 +02:00
David Carlier
de5c760c69
Merge branch 'PHP-8.2' into PHP-8.3 2024-08-09 21:12:34 +01: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
47e4991d38
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15268: heap buffer overflow in phpdbg (zend_hash_num_elements() Zend/zend_hash.h)
2024-08-08 20:35:50 +02: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
97049b44bd
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13199: Redundant prompt in phpdbg with libedit/readline
2024-08-02 08:37:35 +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
751c267850
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-14553: Bug in phpdbg8.3 (also 8.1 and 8.2) echo output - trimmed at NULL byte (?)
2024-07-04 18:44:17 +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