Commit Graph

5942 Commits

Author SHA1 Message Date
Remi Collet
73b3f78ea0
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  more config for new FPM tests
2023-02-14 14:14:34 +01:00
Remi Collet
b11d855dbf
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  more config for new FPM tests
2023-02-14 14:14:03 +01:00
Remi Collet
e86d8704b4
more config for new FPM tests 2023-02-14 14:13:40 +01:00
Jakub Zelenka
cbf089018b
Merge branch 'PHP-8.1' into PHP-8.2 2023-02-14 11:00:20 +00:00
Jakub Zelenka
4058d20608
Merge branch 'PHP-8.0' into PHP-8.1 2023-02-14 10:52:17 +00:00
Jakub Zelenka
716de0cff5
Introduce max_multipart_body_parts INI
This fixes GHSA-54hq-v5wp-fqgv DOS vulnerabality by limitting number of
parsed multipart body parts as currently all parts were always parsed.
2023-02-14 10:21:23 +00:00
David Carlier
81aedad452 opcache/pcntl/cli: Fixes few functions signatures. 2023-02-09 19:57:48 +00:00
Jakub Zelenka
2b71fa6952
Merge branch 'PHP-8.1' into PHP-8.2 2023-02-05 13:10:19 +00:00
Niels Dossche
5b13e83074
Fix GH-10385: FPM successful config test early exit
This introduces an enum `fpm_init_return_status` to propagate the status
up to fpm_main. This also makes the code clearer by not using magic
integer return numbers.

Closes GH-10388
2023-02-05 13:07:29 +00:00
Jakub Zelenka
aa9b5ed1e4
Merge branch 'PHP-8.1' into PHP-8.2 2023-02-05 12:37:40 +00:00
Jakub Zelenka
4199b72c50
Fix GH-10315: FPM unknown child alert not valid
This changes the log level for an unknown child during wait as this is
not unuasual if FPM master has pid 1 and also possible in some cases
for higher pid processes. Based on that and the fact that this is not
really a problem, there is just a debug level message emitted for pid 1
and for higher pid a warning is emitted.

Closes GH-10319
2023-02-05 12:36:02 +00:00
George Peter Banyard
dd5c5ca7a5
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Handle exceptions from __toString in XXH3's initialization
  Fix phpdbg segmentation fault in case of malformed input
2023-01-17 14:16:18 +00:00
Niels Dossche
398a10a58a
Fix phpdbg segmentation fault in case of malformed input
If you were to enter "w $>" the function would crash with a segmentation
fault because last_index is still NULL at that point. Fix it by checking
for NULL and erroring out if it is.

Closes GH-10353

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-17 14:12:49 +00:00
Jakub Zelenka
d0dd77a3c2
Merge branch 'PHP-8.1' into PHP-8.2 2023-01-14 15:14:44 +00:00
Jakub Zelenka
7d98e3e40c
Fix missing comment in FPM www.conf.in 2023-01-14 15:13:55 +00:00
Jakub Zelenka
a8c387e89c
Merge branch 'PHP-8.1' into PHP-8.2 2023-01-13 10:32:52 +00:00
Jakub Zelenka
120aafcc42
Fix bug #67244: Wrong owner:group for listening unix socket
Update FPM www.conf to reflect the actual logic
2023-01-13 10:31:01 +00:00
Jakub Zelenka
1b48a5c802
Fix ASAN reported leak in FPM config test
This happens because config test does not shutdown SAPI.

In addition this commit also fixes few failures when running FPM tests
under root.

Closes GH-10296
2023-01-12 13:52:33 +00:00
George Peter Banyard
e308dc0635 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10251: Assertion `(flag & (1<<3)) == 0' failed.
  Fix GH-9710: phpdbg memory leaks by option "-h"
2023-01-08 16:11:46 +00:00
Niels Dossche
8ff2b6abb2 Fix GH-9710: phpdbg memory leaks by option "-h"
Closes GH-10237

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-08 16:07:00 +00:00
David Carlier
9faa3f1695 Merge branch 'PHP-8.1' into PHP-8.2 2022-12-30 06:53:44 +00:00
Niels Dossche
3a44c78f14 Fix null pointer dereference of param
When the validation logic for param->type was added, the logic did not
account for the case where param could be NULL. The existing code did
take that into account as can be seen in the `if (param)` check below.
Furthermore, phpdbg_set_breakpoint_expression even calls
phpdbg_create_conditional_break with param == NULL.

Fix it by placing the validation logic inside a NULL check.
2022-12-30 06:53:28 +00:00
Jakub Zelenka
21d8980d27
Fix bug #68591: Configuration test does not perform UID lookups
Addition check in fpm config test to verify existence of user, group,
listen.owner and listen.group.

Closes GH-10165
2022-12-26 14:14:14 +00:00
Jakub Zelenka
e7b6c2efd1
Merge branch 'PHP-8.1' into PHP-8.2 2022-12-25 14:49:45 +00:00
Jakub Zelenka
a3891d9d1a
Fix GH-9981: FPM does not reset fastcgi.error_header 2022-12-25 14:44:25 +00:00
George Peter Banyard
0100dbdaf8 Merge branch 'PHP-8.1' into PHP-8.2 2022-12-23 13:57:58 +00:00
Niels Dossche
5f1311a92c Fix undefined behaviour in phpdbg_load_module_or_extension
If zend_register_module_ex were to return NULL, then module_entry will
be set to NULL, and the if's body will load module_entry->name. Since
module_entry is NULL, loading the name would cause a NULL pointer
dereference. However, since a NULL pointer dereference is undefined
behaviour, the compiler is free to remove the check.
Fix it by using *name instead of module_entry->name.

Closes GH-10157

Signed-off-by: George Peter Banyard <girgias@php.net>
2022-12-23 13:55:50 +00:00
Jakub Zelenka
891b58d503
Fix bug #77106: Missing separator in FPM FastCGI errors 2022-12-21 12:00:31 +00:00
Christoph M. Becker
87c2f5b5a2
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-9949: Partial content on incomplete POST request
2022-12-13 15:24:07 +01:00
Christoph M. Becker
aef7d810d3
Fix GH-9949: Partial content on incomplete POST request
`ap_get_brigade()` may fail for different reasons, and we must not
pretend that a partially read POST payload is fine; instead we report
a content length of zero what matches all other `read_post()` callbacks
of bundled SAPIs.

Closes GH-10059.
2022-12-13 15:21:42 +01:00
David Carlier
8a221e2763 fix litespeed SAPI build warnings.
- helpers only called on linux anyway.
- proper C calls prototypes.

Closes GH-10068.
2022-12-10 14:13:30 +00:00
Jakub Zelenka
642fcdb781
Merge branch 'PHP-8.1' into PHP-8.2 2022-11-23 11:36:24 +00:00
Jakub Zelenka
c9c1934ff0
Fix GH-8517: FPM child pointer can be potentially uninitialized
There might be a moment when the child log event is executed after
freeing a child. That could possibly happen if the child output is
triggered at the same as the terminating of the child. Then the output
event could be potentially processed after the terminating event which
would cause this kind of issue.

The issue might got more visible after introducing the log_stream on
a child because it is more likely that this cannot be dereferenced
after free. However it is very hard to reproduce this issue so there
is no test for this.

The fix basically prevents passing a child pointer and instead passes
the child PID and then looks the child up by the PID when it is being
processed. This is obviously slower but it is a safe way to do it and
the slow down should not be hopefully visible in a way that it would
overload a master process.
2022-11-23 11:25:51 +00:00
Jakub Zelenka
94702c56e0
Fix bug #80669: FPM numeric user fails to set groups 2022-11-23 10:38:56 +00:00
Jakub Zelenka
70777ecaca
Merge branch 'PHP-8.1' into PHP-8.2 2022-11-22 18:21:50 +00:00
Jakub Zelenka
5a4520bc2b
Fix bug #68207: Setting fastcgi.error_header can result in a WARNING 2022-11-22 18:17:16 +00:00
Jakub Zelenka
0e7a132918
Merge branch 'PHP-8.1' into PHP-8.2 2022-11-22 18:03:25 +00:00
Jakub Zelenka
31b20f1737
Merge branch 'PHP-8.0' into PHP-8.1 2022-11-22 18:02:11 +00:00
Petr Sumbera
72da2b02e2
php-fpm: fix Solaris port events.mechanism
Closes GH-9959.
2022-11-22 18:01:15 +00:00
George Wang
aef96600d3 Merge branch 'PHP-8.1' into PHP-8.2 2022-11-20 19:30:47 -05:00
George Wang
aee1a2f4c0 Merge branch 'PHP-8.0' into PHP-8.1 2022-11-20 19:30:25 -05:00
George Wang
4bdfce6c1a Use __atomic_xxxx() instead of __sync_xxxx() for lsapi. 2022-11-20 19:30:07 -05:00
Jakub Zelenka
339bd57f42
Merge branch 'PHP-8.1' into PHP-8.2 2022-11-13 19:06:48 +00:00
Jakub Zelenka
b8c1b5e9fa Merge branch 'PHP-8.0' into PHP-8.1 2022-11-13 19:06:10 +00:00
Jakub Zelenka
db2d32f476 Introduce TEST_FPM_EXTENSION_DIR for FPM tests with shared extensions 2022-11-13 19:04:43 +00:00
Jakub Zelenka
22f25532ed
Merge branch 'PHP-8.1' into PHP-8.2 2022-10-30 17:02:32 +00:00
Jakub Zelenka
a04a021105
Merge branch 'PHP-8.0' into PHP-8.1 2022-10-30 17:02:08 +00:00
Jakub Zelenka
8229649045
Fix GH-9770: Add small timeout in status-listen test
This is to allow more time to switch for active to idle in scoreboard as
it seems that Travis is quite short on resources and might not switch it
quickly enough.
2022-10-30 17:00:40 +00:00
Jakub Zelenka
eb9cf18703
Merge branch 'PHP-8.1' into PHP-8.2 2022-10-30 11:46:06 +00:00
Jakub Zelenka
29f7c4613e
Merge branch 'PHP-8.0' into PHP-8.1 2022-10-30 11:43:11 +00:00
Jakub Zelenka
1c5844aa3e
Fix GH-9754: SaltStack hangs when running php-fpm 8.1.11
SaltStack uses Python subprocess and redirects stderr to stdout which is
then piped to the returned output. If php-fpm starts in daemonized mode,
it should close stderr. However a fix introduced in GH-8913 keeps stderr
around so it can be later restored. That causes the issue reported in
GH-9754. The solution is to keep stderr around only when php-fpm runs in
foreground as the issue is most likely visible only there. Basically
there is no need to restore stderr when php-fpm is daemonized.
2022-10-30 11:41:33 +00:00
Ilija Tovilo
ce527ed599
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix cli server blocking on accept when using multiple workers
2022-10-20 13:04:25 +02:00
Ilija Tovilo
6be8efdf78
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix cli server blocking on accept when using multiple workers
2022-10-20 13:04:14 +02:00
Ilija Tovilo
d52f0451ad
Fix cli server blocking on accept when using multiple workers
Fixes GH-9400
Closes GH-9693
2022-10-20 13:03:35 +02:00
Benoit Viguier
58fc34ffb7
Fix memory-leak in CLI web server
Closes GH-9680

Signed-off-by: George Peter Banyard <girgias@php.net>
2022-10-06 11:36:08 +01:00
Jakub Zelenka
da9e9d0004
Merge branch 'PHP-8.1' into PHP-8.2 2022-09-29 15:31:23 +01:00
Jakub Zelenka
6d005c2cec
Merge branch 'PHP-8.0' into PHP-8.1 2022-09-29 15:30:27 +01:00
Jakub Zelenka
8e1cef4341
Do not check X-Powered-By header in FPM tester if expose_php off
Closes GH-9508
2022-09-29 15:27:33 +01:00
Jakub Zelenka
1ed4303957
Improve CS in FPM Tester Response 2022-09-29 15:24:00 +01:00
Ilija Tovilo
138fd5b3c8
Replace reallocarray with safe_perealloc
Fixes GH-9581
2022-09-29 15:15:40 +02:00
Jakub Zelenka
f41eb54a5e
Merge branch 'PHP-8.1' into PHP-8.2 2022-09-27 17:33:58 +01:00
Jakub Zelenka
54cb2cdcd3
Merge branch 'PHP-8.0' into PHP-8.1 2022-09-27 17:31:08 +01:00
Jakub Zelenka
1e8fa6607d
Rework FPM tests logging for better debugging 2022-09-27 17:27:43 +01:00
Jakub Zelenka
e3034dba3e
Fix FPM tester conflict 2022-08-29 22:45:04 +01:00
Jakub Zelenka
f3c357c446
Merge branch 'PHP-8.1' 2022-08-29 22:34:48 +01:00
Jakub Zelenka
bf97b3649d
Merge branch 'PHP-8.0' into PHP-8.1 2022-08-29 22:33:02 +01:00
Jakub Zelenka
3503b1daa2
Fix bug #77780: "Headers already sent" when previous connection was aborted
This change primarily splits SAPI deactivation to module and destroy
parts. The reason is that currently some SAPIs might bail out
on deactivation. One of those SAPI is PHP-FPM that can bail out on
request end if for example the connection is closed by the client
(web sever). The problem is that in such case the resources are not
freed and some values reset. The most visible impact can have not
resetting the PG(headers_sent) which can cause erorrs in the next
request. One such issue is described in #77780 bug which this fixes
and is also cover by a test in this commit. It seems reasonable
to separate deactivation and destroying of the resource which means
that the bail out will not impact it.
2022-08-29 22:25:53 +01:00
Jakub Zelenka
15bca2956b Merge branch 'PHP-8.1' 2022-08-29 16:43:26 +01:00
Jakub Zelenka
7dc3d4b510
Merge branch 'PHP-8.0' into PHP-8.1 2022-08-29 16:42:58 +01:00
Jakub Zelenka
986e7319c5
Re-add fixed tests for GH-8885 2022-08-29 16:42:10 +01:00
Jakub Zelenka
36063873b0
Merge branch 'PHP-8.0' into PHP-8.1 2022-08-29 16:41:19 +01:00
Jakub Zelenka
bcdd9877e1 Fix GH-8885 tests on MacOS 2022-08-29 16:40:31 +01:00
Jakub Zelenka
869ccf17f6
Merge branch 'PHP-8.1' 2022-08-29 14:41:55 +01:00
Jakub Zelenka
be45f540ee
Merge branch 'PHP-8.0' into PHP-8.1 2022-08-29 14:40:57 +01:00
Dmitry Menshikov
f92505cf24
Fix GH-8885: access.log with stderr writes logs to error_log after reload
This fix allows restoring the the original stderr so the logs are
correctly written.
2022-08-29 14:39:24 +01:00
David Carlier
b836007483 Merge branch 'PHP-8.1' 2022-08-28 23:35:46 +01:00
David Carlier
819df032aa Merge branch 'PHP-8.0' into PHP-8.1 2022-08-28 23:33:17 +01:00
David Carlier
e2a5428ca0 FPM fix strict prototype warnings.
Closes GH-8986.
2022-08-28 23:24:23 +01:00
Mikhail Galanin
335979fe1b Add a bit verbosity in FPM logs 2022-08-28 22:35:10 +01:00
Vedran Miletić
7065a222b7 Respond with HTTP status 405 to DELETE/PUT/PATCH request on a static resource
Co-authored-by: Marin Martuslović <marin.martuslovic@student.uniri.hr>
2022-08-28 13:26:30 +01:00
Vedran Miletić
4f509058a9 Respond without body to HEAD request on a static resource
Co-authored-by: Marin Martuslović <marin.martuslovic@student.uniri.hr>
2022-08-28 13:26:30 +01:00
Máté Kocsis
b4ec3e9bc0
Do not generate CONST_CS when registering constants (#9439) 2022-08-28 08:27:19 +02:00
Máté Kocsis
06f86bfc65
Declare phpdbg constants in stubs (#9392) 2022-08-21 19:05:17 +02:00
Ilija Tovilo
98bdb7f99b
Make pestr[n]dup infallible (#9295)
Fixes GH-9128
Closes GH-9295
2022-08-12 12:21:14 +02:00
Michael Voříšek
bd3cd6a41a
Fix unstable sapi test, fix GH-9140 (#9184) 2022-08-04 22:35:44 +01:00
David Carlier
449edd815b phpdbg few fixes, mostly printf-like format issues due to C str -> zend_string mismatches. annotate the allocator wrapper.
Closes #9210.
2022-07-31 19:07:37 +01:00
Nikita Popov
828c93bedc Fix unserialize dictionary generation
We now have namespaced classes in here, and need to escape the
backslashes.
2022-07-30 17:14:22 +02:00
Nikita Popov
107ad28350 Suppress unused-but-set-variable warning in parsers
This is very ugly: Bison provides a yynerrs variable, which is
usually not actually used, but also not annotated with
YY_MAYBE_UNUSED. Suppress this warning by adding a (void)yynerrs
into the top-level reduction action. The alternative would be to
disable the warning for these generated files.
2022-07-28 22:29:42 +02:00
George Peter Banyard
c8f4801382
Convert client->request.request_uri to zend_string (#9086) 2022-07-22 10:39:13 +01:00
Eric Norris
09237f6126
Update request startup error messages 2022-07-18 23:19:59 +01:00
Jakub Zelenka
922371f3b1
Do not send X-Powered-By if headers sent (#9039)
Co-authored-by: Eric Norris <erictnorris@gmail.com>
2022-07-18 18:01:05 +01:00
Felix Wiedemann
db5f6713ee FPM Downgrade occasional "failed to acquire scoreboard" warning
With request timeouts configured, php-fpm occasionally prints the
following warning:

   WARNING: failed to acquire scoreboard

This is happens when php-fpm checks the child scoreboards for timeouts,
but fails to acquire a lock immediately.  As this can (and does) occur
during normal operation, this commit downgrades this to a notice.
2022-07-18 14:40:39 +01:00
David Carlier
079221b30e Merge branch 'PHP-8.1' 2022-07-18 14:40:07 +01:00
David CARLIER
9a8ae45c4b Revert "FPM: Downgrade occasional "failed to acquire scoreboard" warning"
This reverts commit 3040f75f43.
2022-07-18 14:21:54 +01:00
David CARLIER
2a5b2cca85 Revert "FPM: Downgrade occasional "failed to acquire scoreboard" warning"
This reverts commit 3040f75f43.
2022-07-18 14:21:07 +01:00
David Carlier
d0962859f4 Merge branch 'PHP-8.1' 2022-07-18 12:41:24 +01:00
David Carlier
edb173c200 Merge branch 'PHP-8.0' into PHP-8.1 2022-07-18 12:40:47 +01:00
Felix Wiedemann
3040f75f43 FPM: Downgrade occasional "failed to acquire scoreboard" warning
With request timeouts configured, php-fpm occasionally prints the
following warning:

   WARNING: failed to acquire scoreboard

This is happens when php-fpm checks the child scoreboards for timeouts,
but fails to acquire a lock immediately.  As this can (and does) occur
during normal operation, this commit downgrades this to a notice.
Closes #9019.
2022-07-18 12:40:16 +01:00
Jakub Zelenka
0a4a55fd44
Allow to not close stream on rscr dtor in php cli sapi 2022-07-18 10:58:50 +01:00
David Carlier
37e214bdc2 Merge branch 'PHP-8.1' 2022-07-14 12:20:59 +01:00