Commit graph

6461 commits

Author SHA1 Message Date
George Wang
72efe6dcdf Merge branch 'PHP-8.3' into PHP-8.4 2025-05-15 11:53:07 -04:00
George Wang
8e5b3129de Address compiler warnings. 2025-05-15 11:52:49 -04:00
Niels Dossche
d4a3e437ae
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix leak+crash with sapi_windows_set_ctrl_handler()
2025-05-05 19:14:13 +02:00
Niels Dossche
fb3536fd60
Fix leak+crash with sapi_windows_set_ctrl_handler()
The ctrl_handler is never destroyed. We have to destroy it at request
end so we avoid leaking it and also avoid keeping a reference to
previous request memory in a next request. The latter can result in a
crash and can be demonstrated with this script and `--repeat 2`:

```php
class Test {
	public function set() {
		sapi_windows_set_ctrl_handler(self::cb(...));
	}
	public function cb() {
	}
}

$test = new Test;
$test->set();
sleep(3);
```
When you hit CTRL+C in the second request you can crash.

This patch resolves both the leak and crash by destroying the
ctrl_handler after a request.

Closes GH-18231.
2025-05-05 19:13:39 +02:00
George Wang
c08c5ded1a Merge branch 'PHP-8.3' into PHP-8.4 2025-04-27 12:00:12 -04:00
George Wang
03844d1f51 Update LSAPI version to V8.2 2025-04-27 11:59:40 -04:00
George Wang
39a8e5e041 Merge branch 'PHP-8.3' into PHP-8.4 2025-04-27 11:53:14 -04:00
George Wang
58e5d0c240 Update max size of request headers from 65535 to 256K 2025-04-27 11:52:51 -04:00
George Wang
e961488d98 Update SAPI_LITESPEED_PATH to sapi/litespeed/lsphp 2025-04-27 11:47:35 -04:00
George Wang
e4f2e4a99a Update SAPI_LITESPEED_PATH to sapi/litespeed/lsphp 2025-04-27 11:20:32 -04:00
Arnaud Le Blanc
995f11adb1
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Disable ZEND_RC_MOD_CHECK() while loading shared extension in FPM
2025-03-17 17:40:23 +01:00
Arnaud Le Blanc
c531f3d79b
Disable ZEND_RC_MOD_CHECK() while loading shared extension in FPM
This fixes a ZEND_RC_MOD_CHECK() assertion failure when building with
"-DZEND_RC_DEBUG=1 --enable-debug --enable-zts". php_dl() is called after
startup, and manipulates the refcount of persistent strings, which is not
allowed at this point of the lifecycle.

The dl() function disables the ZEND_RC_MOD_CHECK() assertion before calling
php_dl(). This change applies the same workaround in FPM.

Closes GH-18075
2025-03-17 17:40:05 +01:00
Niels Dossche
a67f351b67
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18082: Memory leaks in fuzzer SAPI error paths
2025-03-16 16:38:55 +01:00
Katherine456719
38e553e418
Fix GH-18082: Memory leaks in fuzzer SAPI error paths
Closes GH-18081.
2025-03-16 16:37:59 +01:00
Kévin Dunglas
74a455fb11
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  fix GH-8533: dynamic libphp linking on Mac
2025-03-12 08:58:54 +01:00
Kévin Dunglas
009b5e2bfd
fix GH-8533: dynamic libphp linking on Mac
Pass the -dynamiclib flag to libtool to build
a valid Mac dylib.

Closes GH-8533.
2025-03-12 07:40:02 +01:00
Jakub Zelenka
74d4e67236
Merge branch 'PHP-8.3' into PHP-8.4 2025-02-08 12:07:22 +01:00
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
Niels Dossche
29bafa6323
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in phpdbg calling registered function
  Partially fix GH-17387
2025-01-30 19:31:38 +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
2860c3d641
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix crashes in function registration + test
2025-01-06 21:31:03 +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
2161959834
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17208: bug64539-status-json-encoding.phpt fail on 32-bits
2024-12-27 21:48:52 +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
Niels Dossche
ce322fd1f3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] Make build command for program using embed portable
2024-12-24 14:38:13 +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
0285e9a868
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Include relevant system headers before defining fallbacks
2024-12-22 16:30:04 +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
c4c536da4c
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-22 14:58:08 +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
0cc0c7c7d9
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-14 15:01:17 +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
Jakub Zelenka
d165670d04
Fix GH-16932: wrong FPM status output
Closes GH-16974

Co-authored-by: James Lucas <james@lucas.net.au>
2024-11-28 08:59:55 +01:00
Niels Dossche
5ff67f8720
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-15208: Segfault with breakpoint map and phpdbg_clear()
2024-11-26 22:27:35 +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
7c96af42b7
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-20 11:14:04 +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
49bc011c9f
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-08 16:50:41 +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
2f5021b6bd
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix test with shared zend_test (#16705)
2024-11-05 21:36:48 +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
bfd9e0cca3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16628: FPM logs are getting corrupted with this log statement
  Fix GH-16601: Memory leak in Reflection constructors
2024-11-02 19:38:54 +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
3074cbf5b6
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Skip shebang in cli-server router script
2024-10-14 13:35:41 +02:00