Commit Graph

13902 Commits

Author SHA1 Message Date
Niels Dossche
4bbbe6d652
Fix substr_replace with slots in repl_ht being UNDEF
The check that was supposed to check whether the array slot was UNDEF
was wrong and never triggered. This resulted in a replacement with the
empty string or the wrong string instead of the correct one. The correct
check pattern can be observed higher up in the function's code.

Closes GH-10323

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-15 15:31:34 +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
Niels Dossche
833b45ac44 Fix GH-10249: Assertion `size >= page_size + 1 * page_size' failed.
Co-authored-by: Changochen <changochen1@gmail.com>

Closes GH-10284
2023-01-12 22:00:00 +00:00
Derick Rethans
d12ba111e0 Fixed GH-10218: DateTimeZone fails to parse time zones that contain the "+" character 2023-01-10 15:15:49 +00:00
Niels Dossche
d03025bf59 Fix GH-10251: Assertion `(flag & (1<<3)) == 0' failed.
zend_get_property_guard previously assumed that at least "str" has a
pre-computed hash. This is not always the case, for example when a
string is created by bitwise operations, its hash is not set. Instead of
forcing a computation of the hashes, drop the hash comparison.

Closes GH-10254

Co-authored-by: Changochen <changochen1@gmail.com>

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-08 16:09:59 +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
Alex Dowad
3152b7b26f Use different mblen_table for different SJIS variants 2023-01-06 14:09:43 +02:00
Ben Ramsey
275bf3beae
Update NEWS 2023-01-04 00:08:46 -06:00
Niels Dossche
4c9375e504 Fix GH-10187: Segfault in stripslashes() with arm64
Closes GH-10188

Co-authored-by: todeveni <toni.viemero@iki.fi>
Signed-off-by: George Peter Banyard <girgias@php.net>
2022-12-30 16:40:56 +00:00
George Peter Banyard
c2b0be5570 Fix memory leak in posix_ttyname()
Closes GH-10190
2022-12-30 16:24:28 +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
Max Kellermann
e217138b40 ext/opcache/jit/zend_jit_trace: add missing lock for EXIT_INVALIDATE
Commit 6c25413183 added the flag ZEND_JIT_EXIT_INVALIDATE which
resets the trace handlers in zend_jit_trace_exit(), but forgot to
lock the shared memory section.

This could cause another worker process who still saw the
ZEND_JIT_TRACE_JITED flag to schedule ZEND_JIT_TRACE_STOP_LINK, but
when it arrived at the ZEND_JIT_DEBUG_TRACE_STOP, the handler was
already reverted by the first worker process and thus
zend_jit_find_trace() fails.

This in turn generated a bogus jump offset in the JITed code, crashing
the PHP process.
2022-12-29 12:20:56 +00:00
Max Kellermann
b26b758952 ext/opcache/jit: handle zend_jit_find_trace() failures
Commit 6c25413 added the flag ZEND_JIT_EXIT_INVALIDATE which resets
the trace handlers in zend_jit_trace_exit(), but forgot to consider
that on ZEND_JIT_TRACE_STOP_LINK, this changed handler gets passed to
zend_jit_find_trace(), causing it to fail, either by returning 0
(results in bogus data) or by aborting due to ZEND_UNREACHABLE().  In
either case, this crashes the PHP process.

I'm not quite sure how to fix this multi-threading problem properly;
my suggestion is to just fail the zend_jit_trace() call.  After all,
the whole ZEND_JIT_EXIT_INVALIDATE fix was about reloading modified
scripts, so there's probably no point in this pending zend_jit_trace()
call.
2022-12-26 21:17:19 +00:00
Jakub Zelenka
a3891d9d1a
Fix GH-9981: FPM does not reset fastcgi.error_header 2022-12-25 14:44:25 +00:00
Derick Rethans
29926c3262 Merge remote-tracking branch 'derickr/gh10072-execute-ex' into PHP-8.1 2022-12-23 16:36:31 +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
Niels Dossche
c4487b7a12
Initialize ping_auto_globals_mask to prevent undefined behaviour
Closes GH-10121
2022-12-22 14:59:24 +01:00
Arnaud Le Blanc
6de376a2b4 [ci skip] NEWS 2022-12-21 14:55:21 +01:00
Derick Rethans
d19a70c9a0 Fix GH-9891: DateTime modify with unixtimestamp (@) must work like setTimestamp 2022-12-20 14:41:13 +00:00
Christoph M. Becker
b8ac2071b8
Fix GH-10112: LDAP\Connection::__construct() refers to ldap_create()
There is no `ldap_create()`, but rather `ldap_connect()`.

Closes GH-10115.
2022-12-16 14:36:30 +01:00
Tyson Andre
7a983e281c
Fix Windows shmget() wrt. IPC_PRIVATE
Fixes #9944

https://man7.org/linux/man-pages/man2/shmget.2.html notes

   The name choice IPC_PRIVATE was perhaps unfortunate, IPC_NEW
   would more clearly show its function.

Closes GH-9946.
2022-12-13 15:46:40 +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
Ben Ramsey
696bb385df
PHP-8.1 is now for PHP 8.1.15-dev 2022-12-07 11:29:37 -06:00
Christoph M. Becker
2f6b9e6c63
Fix #81742: open_basedir bypass in SQLite3 by using file URI
A previous fix[1] was not sufficient to catch all potential file URIs,
because the patch did not cater to URL encoding.  Properly parsing and
decoding the URI may yield a different result than the handling of
SQLite3, so we play it safe, and reject any file URIs if open_basedir
is configured.

[1] <https://bugs.php.net/bug.php?id=77967>

Closes GH-10018.
2022-12-06 15:59:52 +01:00
George Peter Banyard
608ddb0321
Fix GH-10011 (Trampoline autoloader will get reregistered and cannot be unregistered)
There are two issues to resolve:
 1. The FCC is not refetch when trying to unregister a trampoline
 2. Comparing the function pointer of trampolines is meaningless as they are reallocated, thus we need to compare the name of the function

Found while working on GH-8294

Closes GH-10033
2022-12-02 12:47:25 +00:00
蝦米
93592ea743
Fix GH-9769: Misleading error message for unpacking of objects
Only arrays can be unpacked in constant expressions.

Closes GH-9776.
2022-12-02 13:10:59 +01:00
Derick Rethans
d021851171 Fixed GH-9699, GH-9866, and GH-9880 (problems with diff); and GH-9700 (greedy tzid parsing) 2022-11-30 15:47:43 +00:00
Christoph M. Becker
44377c3c70
Fix GH-9971: Incorrect NUMERIC value returned from PDO_Firebird
Dialect 1 databases store and transfer `NUMERIC(15,2)` values as
doubles, which we need to cater to in `firebird_stmt_get_col()` to
avoid `ZEND_ASSUME(0)` to ever be triggered, since that may result
in undefined behavior.

Since adding a regression test would require to create a dialect 1
database, we go without it.

Closes GH-10021.
2022-11-30 12:11:42 +01:00
Jakub Zelenka
500b28ad04
Fix GH-10000: Test failures when OpenSSL compiled with no-dsa 2022-11-25 14:02:03 +00:00
Arnaud Le Blanc
4987e65a70 [ci skip] NEWS 2022-11-25 14:07:30 +01:00
Jakub Zelenka
ce57221376 Fix GH-9064: PHP fails to build if openssl was built with no-ec 2022-11-25 12:49:12 +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
1767f32cb6
[ci skip] Fix NEWS FPM entries 2022-11-22 18:47:24 +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
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 Peter Banyard
6fbf81c674
Fix GH-9883 SplFileObject::__toString() reads next line
We need to overwrite the __toString magic method for SplFileObject, similarly to how DirectoryIterator overwrites it
Moreover, the custom cast handler is useless as we define __toString methods, so use the standard one instead.

Closes GH-9912
2022-11-22 12:21:14 +00:00
Christoph M. Becker
2d94ee5f20
Avoid undefined behavior in Windows ftok(3) emulation
`.nFileIndexHigh` is a unsigned 32bit number.  Casting that to `__int64`
and shifting left by 32bits triggers undefined behavior if the most
significant bit of `.nFileIndexHigh` is set.  We could avoid that by
casting to `(__uint64)`, but in that case the whole clause doesn't have
an effect anymore, so we drop it altogether.

Closes GH-9958.
2022-11-18 14:37:00 +01:00
Michael Voříšek
8d65c2fee5
Fix GH-9650: Can't initialize heap: [0x000001e7]
Closes GH-9721.
2022-11-17 14:16:10 +01:00
David Carlier
a4298c14c1 Fix GH-9932: Discards further characters for session name.
As those are converted, it s better to make aware of the code caller of the naming inadequacy.
Closes GH-9940.
2022-11-15 12:27:44 +00:00
Alex Dowad
1562ba5b71 [ci skip] NEWS 2022-11-13 14:40:45 +02:00
Arnaud Le Blanc
73583bb8c0 [ci skip] NEWS 2022-11-13 11:05:12 +01:00
Akama Hitoshi
af68beb16a
[ci skip] Fix GH-9918: License information for xxHash is not included in README.REDIST.BINS file
Closes GH-9919.
2022-11-10 12:37:08 +01:00
Christoph M. Becker
b2186ca7c4
Fix GH-9905: constant() behaves inconsistent when class is undefined
Directly referring to a constant of an undefined throws an exception;
there is not much point in `constant()` raising a fatal error in this
case.

Closes GH-9907.
2022-11-09 15:21:50 +01:00
Sara Golemon
ac508301c9
Bump for 8.0.27 2022-11-08 22:10:29 +00:00
Patrick Allaert
540488c74e
PHP-8.1 is now for PHP 8.1.14-dev 2022-11-08 17:57:34 +01:00
Arnaud Le Blanc
1cd217038e [ci skip] NEWS 2022-11-04 16:01:52 +01:00
Arnaud Le Blanc
1d67e34c49 [ci skip] NEWS 2022-11-04 15:58:07 +01:00
Christoph M. Becker
8bf6266e65
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix potential NULL pointer dereference Windows shm*() functions
2022-11-02 14:53:30 +01:00
Christoph M. Becker
d1c9ff5642
Fix potential NULL pointer dereference Windows shm*() functions
`shm_get()` (not to be confused with `shmget()`) returns `NULL` if
reallocation fails; we need to cater to that when calling the function.

Closes GH-9872.
2022-11-02 14:51:59 +01:00