1
0
mirror of https://github.com/php/php-src.git synced 2026-04-22 07:28:09 +02:00
Commit Graph

1286 Commits

Author SHA1 Message Date
Ilija Tovilo 9d5f2f1343 Use new ZSTR_INIT_LITERAL macro (#10879) 2023-03-20 16:19:05 +01:00
Jakub Zelenka 5efd60ea90 Merge branch 'PHP-8.2' 2023-03-19 13:17:56 +00:00
Jakub Zelenka 2b0d29bf17 Merge branch 'PHP-8.1' into PHP-8.2 2023-03-19 13:17:09 +00:00
Jakub Zelenka 0d4d471847 Fix bug #74129: Incorrect SCRIPT_NAME with apache ProxyPassMatch
This happens when there are spaces are in the path info. The reason is
that Apache decodes the path info part in the SCRIPT_NAME as per CGI
RFC. FPM tries to strip path info from the SCRIPT_NAME but the
comparison is done against SCRIPT_FILENAME which is not decoded. For
that to work we have to decode it before comparison if there is any
encoded character.

Closes GH-10869
2023-03-19 13:11:14 +00:00
Niels Dossche 674bcca513 Merge branch 'PHP-8.2'
* PHP-8.2:
  Destroy file_handle in fpm_main
2023-03-18 21:05:44 +01:00
Niels Dossche e44b1a916d Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Destroy file_handle in fpm_main
2023-03-18 21:00:21 +01:00
Niels Dossche f30e71cbde Destroy file_handle in fpm_main
If it's not in the CG(open_files) list, we need to destroy the file
handle ourselves.

Co-authored-by: Jakub Zelenka <bukka@php.net>

Closes GH-10707.
2023-03-18 20:54:46 +01:00
Jakub Zelenka 31ccfbd6f6 Merge branch 'PHP-8.2' 2023-03-17 14:57:14 +00:00
Jakub Zelenka 4ac12006ae Merge branch 'PHP-8.1' into PHP-8.2 2023-03-17 14:56:45 +00:00
Jakub Zelenka 7d987ebbbf Fix FPM tester $scriptName logic 2023-03-17 14:55:51 +00:00
Jakub Zelenka 856925ccb4 Merge branch 'PHP-8.2' 2023-03-17 10:45:49 +00:00
Jakub Zelenka e9bbddcdaf Merge branch 'PHP-8.1' into PHP-8.2 2023-03-17 10:45:14 +00:00
Jakub Zelenka 38d2e7ea9a Test FPM FCGI envs with path info fix for Apache proxy pass 2023-03-17 10:42:16 +00:00
Jakub Zelenka 8cf621e0e4 Test FPM FCGI envs with path info fix for Apache proxy handler 2023-03-17 10:42:16 +00:00
Jakub Zelenka b53b0ac2ea Test FPM FCGI envs with path info fix for Apache proxy balancer 2023-03-17 10:42:15 +00:00
Jakub Zelenka 92d2cd5cb8 Test FPM FCGI envs without path info fix for custom source 2023-03-17 10:42:15 +00:00
Jakub Zelenka 3125155b5d Add extra option to FPM tester for handling script filename 2023-03-17 10:42:14 +00:00
Niels Dossche e2ec59f0c4 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-10611: fpm_env_init_main leaks environ
2023-03-11 16:39:23 +01:00
Niels Dossche 6a44705f4e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10611: fpm_env_init_main leaks environ
2023-03-11 16:35:11 +01:00
Niels Dossche 71c63723c8 Fix GH-10611: fpm_env_init_main leaks environ
Closes GH-10618.
2023-03-11 16:34:41 +01:00
Niels Dossche b39ff334a3 Merge branch 'PHP-8.2'
* PHP-8.2:
  Re-add some CTE functions that were removed from being CTE by a mistake
  Fix GH-8065: opcache.consistency_checks > 0 causes segfaults in PHP >= 8.1.5 in fpm context
  Fix GH-8646: Memory leak PHP FPM 8.1
2023-03-07 20:36:41 +01:00
Niels Dossche 7682868dd1 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-8065: opcache.consistency_checks > 0 causes segfaults in PHP >= 8.1.5 in fpm context
  Fix GH-8646: Memory leak PHP FPM 8.1
2023-03-07 20:26:57 +01:00
Niels Dossche ff62d117a3 Fix GH-8646: Memory leak PHP FPM 8.1
Fixes GH-8646
See https://github.com/php/php-src/issues/8646 for thorough discussion.

Interned strings that hold class entries can get a corresponding slot in map_ptr for the CE cache.
map_ptr works like a bump allocator: there is a counter which increases to allocate the next slot in the map.

For class name strings in non-opcache we have:
  - on startup: permanent + interned
  - on request: interned
For class name strings in opcache we have:
  - on startup: permanent + interned
  - on request: either not interned at all, which we can ignore because they won't get a CE cache entry
                or they were already permanent + interned
                or we get a new permanent + interned string in the opcache persistence code

Notice that the map_ptr layout always has the permanent strings first, and the request strings after.
In non-opcache, a request string may get a slot in map_ptr, and that interned request string
gets destroyed at the end of the request. The corresponding map_ptr slot can thereafter never be used again.
This causes map_ptr to keep reallocating to larger and larger sizes.

We solve it as follows:
We can check whether we had any interned request strings, which only happens in non-opcache.
If we have any, we reset map_ptr to the last permanent string.
We can't lose any permanent strings because of map_ptr's layout.

Closes GH-10783.
2023-03-07 20:16:17 +01:00
Michael Orlitzky fa65873502 */*.m4: update main() signatures.
The next generation of C compilers is going to enforce the C standard
more strictly:

  https://wiki.gentoo.org/wiki/Modern_C_porting

One warning that will soon become an error is -Wstrict-prototypes.
This is relatively easy to catch in most code (it will fail to
compile), but inside of autoconf tests it can go unnoticed because
many feature-test compilations fail by design. For example,

  $ export CFLAGS="$CFLAGS -Werror=strict-prototypes"
  $ ./configure
  ...
  checking if iconv supports errno... no
  configure: error: iconv does not support errno

(this is on a system where iconv *does* support errno). If errno
support were optional, that test would have "silently" disabled
it. The underlying issue here, from config.log, is

  conftest.c:211:5: error: function declaration isn't a prototype
  [-Werror=strict-prototypes]
    211 | int main() {

This commit goes through all of our autoconf tests, replacing main()
with main(void). Up to equivalent types and variable renamings, that's
one of the two valid signatures, and satisfies the compiler (gcc-12 in
this case).

Fixes GH-10751
2023-03-07 15:32:30 +00:00
Max Kellermann d6e95041e2 Zend/zend_types.h: move zend_rc_debug to zend_rc_debug.h
`zend_rc_debug` is not a type and does not really belong in
`zend_types.h`; this allows using `ZEND_RC_MOD_CHECK()` without
including the huge `zend_types.h` header and allows decoupling
circular header dependencies.
2023-02-26 14:16:53 +00:00
Max Kellermann ff2a211d55 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.
2023-02-21 15:50:31 +00:00
Max Kellermann d46dea169c Make globals const (part 2) (#10610)
* Zend/zend_enum: make `forbidden_methods` static+const

* main/php_syslog: make `xdigits` static

* sapi/fpm: make several globals `const`

* sapi/phpdbg: make `OPTIONS` static

* sapi/phpdbg/help: make help texts const

* sapi/cli: make `template_map` const

* ext/ffi: make `zend_ffi_types` static

* ext/bcmath: make `ref_str` const

* ext/phar: make several globals static+const
2023-02-18 19:52:53 +00:00
Remi Collet 6ec4856dc3 Merge branch 'PHP-8.2'
* PHP-8.2:
  more config for new FPM tests
2023-02-14 14:14:52 +01:00
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 c81b7ce1a3 Merge branch 'PHP-8.2' 2023-02-14 11:07:59 +00: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
Jakub Zelenka a5f27fdf71 Merge branch 'PHP-8.2' 2023-02-05 13:10:55 +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 6a088936a3 Merge branch 'PHP-8.2' 2023-02-05 12:38:12 +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
Peter Kokot 3030d956d9 [skip ci] Update year to 2023 (#10374) 2023-01-19 12:01:29 +01:00
Christoph M. Becker c8955c078a Revert GH-10220
Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491.
This reverts commit 588a07f737.
This reverts commit f377e15751.
This reverts commit b4ba16fe18.
This reverts commit 694ec1deea.
This reverts commit 6b34de8eba.
This reverts commit aa1cd02a43.
This reverts commit 308fd311ea.
This reverts commit 16203b53e1.
This reverts commit 738fb5ca54.
This reverts commit 9fdbefacd3.
This reverts commit cd4a7c1d90.
This reverts commit 928685eba2.
This reverts commit 01e5ffc85c.
2023-01-16 12:27:33 +01:00
Jakub Zelenka abc41c2e00 Merge branch 'PHP-8.2' 2023-01-14 15:15:12 +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 0d74362f63 Merge branch 'PHP-8.2' 2023-01-13 10:33:51 +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 da4775f071 Merge branch 'PHP-8.2' 2023-01-12 13:55:47 +00:00