Commit Graph

5714 Commits

Author SHA1 Message Date
Arnaud Le Blanc
6465f3ed13 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  XFAIL tests (GH-8588)
  Stop closing stderr and stdout streams (#8569)
2022-05-20 13:36:22 +02:00
Levi Morrison
fa78e17724 Stop closing stderr and stdout streams (#8569)
Extensions may (and do) write to stderr in mshutdown and similar. In
the best case, with the stderr stream closed, it's just swallowed.

However, some libraries will do things like try to detect color, and
these will outright fail and cause an error path to be taken.
2022-05-20 13:27:23 +02:00
Jakub Zelenka
82eea0efc9 Merge branch 'PHP-8.0' into PHP-8.1 2022-05-10 21:39:31 +01:00
Jakub Zelenka
23a2030438 Fix bug #72185: php-fpm writes empty fcgi record causing nginx 502
This issue might happen if there is change of the fcgi stream when
the buffer is full. Then the empty record is created which signals
end of stream which is incorrect.

The actual fix without a test was contributed by GitHub user @loveharmful
in GH-3198.
2022-05-10 21:36:55 +01:00
Jakub Zelenka
0332b62c35 Merge branch 'PHP-8.0' into PHP-8.1 2022-04-29 20:41:13 +01:00
David CARLIER
ef06f0f50b
Fix FPM ACL build check on MacOS
MacOS has got ACL support but without user/group support.
2022-04-29 20:39:22 +01:00
Jakub Zelenka
21d551ad0f Merge branch 'PHP-8.0' into PHP-8.1 2022-04-27 19:14:47 +01:00
Jakub Zelenka
0df28869f6 Add skip for FPM resource heavy tests 2022-04-27 19:11:47 +01:00
Jakub Zelenka
8da14a3062
Merge branch 'PHP-8.0' into PHP-8.1 2022-04-23 15:16:00 +01:00
David Carlier
ff90d42b8b
Fix FPM kqueue handler fix remove callback typo
It avoids confusion on failed event.
2022-04-23 15:11:53 +01:00
Jakub Zelenka
abd56aeb9a Merge branch 'PHP-8.0' into PHP-8.1 2022-04-22 23:07:01 +01:00
Jakub Zelenka
d8612fb6b7
Fix bug #77023: FPM cannot shutdown processes
This change introduces subsequent kill of the process when idle process quit
(SIGQUIT) does not succeed. It can happen in some situations and means that FPM
is not able to scale down in dynamic pm. Using SIGKILL fixes the issue.
2022-04-22 20:51:02 +01:00
Jakub Zelenka
a57625374d Merge branch 'PHP-8.0' into PHP-8.1 2022-04-15 22:21:18 +01:00
David Carlier
2f0918c638
Fix FPM socket clean up reallocation clang build warning 2022-04-15 22:20:15 +01:00
David Carlier
fc9fecbd09
Fix FPM zlog warning with var being uninitialized 2022-04-15 22:19:36 +01:00
Jakub Zelenka
62b676ff0f Merge branch 'PHP-8.0' into PHP-8.1 2022-04-12 23:15:34 +01:00
Jakub Zelenka
33bb201b3e
Fix bug #76003: FPM /status reports wrong number of active processe
The fix introduces early locking of scoreboard when it is updated
which prevents the race condition causing an incorrect number of
active processes being set.
2022-04-12 23:12:11 +01:00
Christoph M. Becker
720d6faa29
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix bugtracker URL
2022-02-15 19:15:24 +01:00
Christoph M. Becker
e98a7a68b7
Fix bugtracker URL
The php-src bugtracker is now on Github.

Closes GH-8102.
2022-02-15 19:14:07 +01:00
Jakub Zelenka
49087a65ee
Merge branch 'PHP-8.0' into PHP-8.1 2022-02-09 23:23:05 +00:00
Till Backhaus
29fe06fa59
Fix bug #76109: Implement fpm_scoreboard_copy
fpm_scoreboard_copy locks the scoreboard while copying the scoreboard and all
proc scoreboards. proc scoreboards are locked one by one while copying each
struct. The old implementation (inside fpm_handle_status_request) only briefly
locked the scoreboard while copying the scorebard.

Closes GH-7931

Co-authored-by: Jakub Zelenka <bukka@php.net>
2022-02-09 23:02:45 +00:00
Christoph M. Becker
2b07513192
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix memory leak on invalid port
2022-01-08 21:06:39 +01:00
David Carlier
c99a026c9c
Fix memory leak on invalid port
Closes GH-7911.
2022-01-08 21:04:55 +01:00
Stefano Arlandini
46bec6de42 Fix the OpenMetrics response format returned by the FPM status page
Closes GH-7843, closes GH-7842
2022-01-04 23:01:10 +00:00
Christoph M. Becker
5d4bef0d0c
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix buffer allocations in zlog_stream_set_msg_suffix()
2021-12-28 13:28:55 +01:00
David Carlier
cb3d858745
Fix buffer allocations in zlog_stream_set_msg_suffix()
If that code was used, there would be a UAF scenario.

Closes GH-7835.
2021-12-28 13:27:54 +01:00
Jakub Zelenka
a529d0dd15 Merge branch 'PHP-8.0' into PHP-8.1 2021-11-27 22:39:51 +00:00
Jakub Zelenka
81513e6285 Add skip for FPM process idle flaky test 2021-11-27 22:37:43 +00:00
Remi Collet
ef2fd0e5b5
fix [-Wstrict-prototypes] buid warnings 2021-11-24 14:55:11 +01:00
Jakub Zelenka
435a5aca89 Add FPM test for php_admin_value doc_root usage
Closes GH-7673.
2021-11-23 18:36:04 +01:00
Jakub Zelenka
79f0e486fd Merge branch 'PHP-8.0' into PHP-8.1 2021-11-20 20:44:02 +00:00
Jakub Zelenka
2f8407f185 Increase read timeout in FPM process idle test 2021-11-20 20:42:19 +00:00
Jakub Zelenka
fc67967190 Increase script sleep in FPM process idle test 2021-11-20 20:42:19 +00:00
Nikita Popov
36d2d27980 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Update reflection test after stub change
2021-11-18 11:16:35 +01:00
Nikita Popov
e81ad637f4 Update reflection test after stub change 2021-11-18 11:16:13 +01:00
Jakub Zelenka
48bc4ea758 Merge branch 'PHP-8.0' into PHP-8.1 2021-11-14 20:14:22 +00:00
Jakub Zelenka
ec3d4409a4 Merge branch 'PHP-7.4' into PHP-8.0 2021-11-14 20:10:42 +00:00
Jakub Zelenka
b2cf9b7ec7 Fix bug #81513 (Future possibility for heap overflow in FPM zlog)
This fixes currently unused code path in zlog that could lead to
the heap overflow in the future.
2021-11-14 20:08:57 +00:00
Nikita Popov
4a5d75e3ec Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix leaks for AppArmor based distros in case the profile creation fails
2021-11-12 14:26:03 +01:00
David Carlier
b1e6fdefd4 Fix leaks for AppArmor based distros in case the profile creation fails
Closes GH-7646.
2021-11-12 14:25:52 +01:00
Nikita Popov
b0ec6223e2 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Implement Stringable automatically for internal classes
2021-11-05 10:23:23 +01:00
Nikita Popov
b302bfabe7 Implement Stringable automatically for internal classes
Requiring all internal classes (including those from 3rd-party
extensions) to implement Stringable if they provide __toString()
is too error prone. Case in point, our _ZendTestClass test class
was not doing so, resulting in preloading test failures after
recent changes.

Instead we automatically implement Stringable, the same as we do
for userland classes. We still allow explicit implementations,
but ignore them (normally they would result in an error due to
duplicate interface implementation). Finally, we need to be
careful about not trying to implement Stringable on Stringable
itself.

In some cases this changes the interface order, in particular the
automatic Stringable implementation will now come first.
2021-11-05 10:22:04 +01:00
Nikita Popov
fb5cff1272 Print array defaults in reflection
As a followup to f34114b1fb print
the contents of arrays rather than just a generic "Array" marker.
Also drop the truncation on strings. As we no longer resolve
constants, there should be less concerns about printing very
large strings here. If someone thought it was a good idea to use
a 10k character strings as a default value in code, then it should
be fine for us to print it in reflection as well.
2021-10-20 15:16:29 +02:00
Stanislav Malyshev
0acfd2d7b5
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix bug #81026 (PHP-FPM oob R/W in root process leading to priv escalation)
  Add FPM fix news
  Fix bug #81026 (PHP-FPM oob R/W in root process leading to priv escalation)
2021-10-18 15:23:08 -07:00
Jakub Zelenka
fadb1f8c1d
Fix bug #81026 (PHP-FPM oob R/W in root process leading to priv escalation)
The main change is to store scoreboard procs directly to the variable sized
array rather than indirectly through the pointer.

Signed-off-by: Stanislav Malyshev <stas@php.net>
2021-10-18 15:06:36 -07:00
David Carlier
f71810fb6f Fix some FPM printf warnings on openbsd
Closes GH-7585.
2021-10-18 11:11:33 +02:00
Jakub Zelenka
cb2021e5f6
Fix bug #81026 (PHP-FPM oob R/W in root process leading to priv escalation)
The main change is to store scoreboard procs directly to the variable sized
array rather than indirectly through the pointer.

Signed-off-by: Stanislav Malyshev <stas@php.net>
2021-10-17 20:16:10 -07:00
Christoph M. Becker
f99c69fc2e
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81518: Header injection via default_mimetype / default_charset
2021-10-14 12:23:43 +02:00
Christoph M. Becker
b7f3b67060
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81518: Header injection via default_mimetype / default_charset
2021-10-14 12:21:35 +02:00
Christoph M. Becker
365769366b
Fix #81518: Header injection via default_mimetype / default_charset
We forbid setting these INI options to values containing NUL bytes, CR
or LF.

Closes GH-7574.
2021-10-14 12:16:19 +02:00
Joe Watkins
03e9bed5b5
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81496: CLI server logs wrong request method
2021-10-05 08:43:09 +02:00
Lauri Kenttä
cdcdb33080
Fix #81496: CLI server logs wrong request method 2021-10-05 08:42:38 +02:00
Nikita Popov
cd84480e54 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Disable failing FPM test
2021-10-04 23:31:40 +02:00
Nikita Popov
a00d933242 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Disable failing FPM test
2021-10-04 23:31:31 +02:00
Nikita Popov
4c01bd2ade Disable failing FPM test
Test fails intermittently, e.g.:

https://dev.azure.com/phpazuredevops/PHP/_build/results?buildId=20597&view=ms.vss-test-web.build-test-results-tab&runId=475324&resultId=115501&paneView=debug

Possibly this is because the two requests end up being processed
in sequence and no second process is spawned.
2021-10-04 23:30:14 +02:00
Jakub Zelenka
7dd87b2343 Merge branch 'PHP-8.0' into PHP-8.1 2021-10-04 21:56:06 +01:00
Jakub Zelenka
9ed95846a3 Merge branch 'PHP-7.4' into PHP-8.0 2021-10-04 21:55:21 +01:00
Jakub Zelenka
66a655fdf4 Add the actual test for FPM prod idle timeout test with 6s sleep 2021-10-04 21:54:32 +01:00
Jakub Zelenka
2cd69115d5 Merge branch 'PHP-7.4' into PHP-8.0 2021-10-04 21:53:34 +01:00
Jakub Zelenka
edfb347019 Add FPM prod idle timeout test with 6s sleep 2021-10-04 21:50:57 +01:00
Nikita Popov
0431bd3137 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Revert "Add FPM prod idle timeout test"
  [ci skip] Fix missing NEWS
  [ci skip] Add missing NEWS
2021-10-04 10:17:07 +02:00
Nikita Popov
987aee10a9 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Revert "Add FPM prod idle timeout test"
2021-10-04 10:16:53 +02:00
Nikita Popov
69514e6ffb Revert "Add FPM prod idle timeout test"
This reverts commit 08f52b1643.

The newly added test fails.
2021-10-04 10:16:20 +02:00
Jakub Zelenka
4ef6280b9a Fix conflicting pattern wrapping in FPM openmetrics test 2021-10-02 18:31:49 +01:00
Jakub Zelenka
390d4e94ed Merge branch 'PHP-8.0' into PHP-8.1 2021-10-02 18:29:25 +01:00
Jakub Zelenka
ca3f20209f Merge branch 'PHP-7.4' into PHP-8.0 2021-10-02 18:27:47 +01:00
Jakub Zelenka
08f52b1643
Add FPM prod idle timeout test 2021-10-02 18:26:18 +01:00
Nikita Popov
14f599ea7d Use zend_long for resource ID
Currently, resource IDs are limited to 32-bits. As resource IDs
are not reused, this means that resource ID overflow for
long-running processes is very possible.

This patch switches resource IDs to use zend_long instead, which
means that on 64-bit systems, 64-bit resource IDs will be used.
This makes resource ID overflow practically impossible.

The tradeoff is an 8 byte increase in zend_resource size.

Closes GH-7436.
2021-08-31 14:58:59 +02:00
Nikita Popov
0f926815ca Fix strict-prototypes warning 2021-08-30 10:43:21 +02:00
Nikita Popov
93a88a1d4c Limit internal function args during fuzzing
Restrict the size of string arguments in the hope of avoiding some
very common timeouts with pcre. If this doesn't work, the functions
need to be disabled entirely.
2021-08-26 15:08:23 +02:00
Nikita Popov
cae80ef552 Limit internal function calls in execute fuzzer
Infinite recursion might occur purely through internal functions,
without reentering the executor.
2021-08-26 14:42:45 +02:00
Christoph M. Becker
be2df43b08
Fix #78919: CLI server: insufficient cleanup if request startup fails
We need to run the full `php_cli_server_request_shutdown()` in case of
failing `php_cli_server_request_startup()`.

Patch contributed by @cataphract.

Closes GH-7322.
2021-08-17 12:41:06 +02:00
Joe Watkins
a2e051921a
Fix bug #81280 refuse to allow unicode chars in prompts 2021-08-11 10:35:00 +02:00
Christoph M. Becker
4645a9d10f
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
2021-07-29 13:28:52 +02:00
Christoph M. Becker
92b1c17417
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
2021-07-29 13:21:05 +02:00
Christoph M. Becker
3b461d93e1
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
2021-07-29 13:19:04 +02:00
Christoph M. Becker
d1ccb5bd0c
Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
While our HTTP parser supports upgrade requests, the code using it does
not.  Since upgrade requests are only valid for HTTP/1.1 and we neither
support any higher version, nor HTTPS yet, we do not exit early in case
of such requests, i.e. we ignore them, what is allowed by the specs.

We keep the supporting code in case we can meaningfully support upgrade
requests in the future.

Closes GH-7316.
2021-07-29 13:16:15 +02:00
Jakub Zelenka
590af4678b
Sync the FPM openmetrics status with php-fpm_exporter 2021-07-21 19:58:36 +01:00
Máté Kocsis
75a678a7e3
Declare tentative return types for Zend (#7251)
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-07-19 13:44:20 +02:00
Christoph M. Becker
be5fd30d54
Fix Windows debug builds
`ZEND_ATOL` doesn't accept a size argument.
2021-07-16 00:41:38 +02:00
Christoph M. Becker
1f9b044c80
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80849: HTTP Status header truncation
2021-07-15 19:16:21 +02:00
Christoph M. Becker
bb4dbbc150
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80849: HTTP Status header truncation
2021-07-15 19:13:58 +02:00
Christoph M. Becker
a054ef2aad
Fix #80849: HTTP Status header truncation
While truncating the contents of a header is okay, we must never omit
the trailing CRLF.

Closes GH-7238.
2021-07-15 19:10:53 +02:00
Joe Watkins
60fbd6df95
replace phpdbg custom opcode dumper with O+ dump (#7227) 2021-07-13 15:32:14 +02:00
Christoph M. Becker
497858a043
Merge branch 'PHP-8.0'
* PHP-8.0:
  exit_status is no longer a true global
2021-07-12 23:40:16 +02:00
Christoph M. Becker
1631b96b4b
exit_status is no longer a true global 2021-07-12 23:39:10 +02:00
Christoph M. Becker
057d2f2a00
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #73226: --r[fcez] always return zero exit code
2021-07-12 23:14:15 +02:00
Christoph M. Becker
0c0ecf0470
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #73226: --r[fcez] always return zero exit code
2021-07-12 23:12:19 +02:00
Christoph M. Becker
9db3eda2cb
Fix #73226: --r[fcez] always return zero exit code
This makes the behavior consistent with `--ri`, and is likely useful
for scripting.

Closes GH-7221.
2021-07-12 23:09:28 +02:00
Nikita Popov
989205e95c Remove incorrect uses of zend_atoi()
zend_atoi() parses integers with size suffixes (like "128M").
These just want to use a plain number, so use ZEND_ATOL instead.
2021-07-12 16:56:00 +02:00
Nikita Popov
efbb2198d4 Return value from ZEND_ATOL
Instead of assigning it as part of the macro itself, which makes
usage quite awkward.
2021-07-12 16:51:24 +02:00
Nikita Popov
600dc57f24 Add ext/reflection to execute parser corpus 2021-07-04 12:31:14 +02:00
Christoph M. Becker
970a909caf
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix new test for PHP 8
2021-06-30 16:50:28 +02:00
Christoph M. Becker
9b7b4c47d6
Fix new test for PHP 8 2021-06-30 16:48:31 +02:00
Christoph M. Becker
0189c8b740
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #73630: Built-in Weberver - overwrite $_SERVER['request_uri']
2021-06-30 16:17:02 +02:00
Christoph M. Becker
70b0330e53
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #73630: Built-in Weberver - overwrite $_SERVER['request_uri']
2021-06-30 16:15:50 +02:00
Christoph M. Becker
d7db5701a3
Fix #73630: Built-in Weberver - overwrite $_SERVER['request_uri']
The built-in Webserver's `on_path`, `on_query_string` and `on_url`
callbacks may be called multiple times from the parser; we must not
simply replace the old values, but need to concatenate the new values
instead.

This appears to be tricky for `on_path` due to the path normalization,
so we fail if the function is called again.

The built-in Webserver logs errors during request parsing to stderr,
but this is ignored by the php_cli_server framework, and apparently the
Webserver does not send a resonse at all in such cases (instead of an
4xx).  Thus we can only check that a request with an overly long path
fails.

Closes GH-7207.
2021-06-30 16:13:08 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Joe Watkins
6318040df2
remove specialized printing from phpdbg (#7156) 2021-06-17 14:22:33 +02:00
Nikita Popov
9871a624bf Clean up some more function_exists() checks 2021-06-14 15:47:08 +02:00