1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Commit Graph

140064 Commits

Author SHA1 Message Date
Jorg Adam Sowa
ac2ce94de0 zend_hrtime: Fix build for macOS without clock_gettime_nsec_np() (#17437) 2025-01-16 18:57:51 +01:00
Christoph M. Becker
5c39a4636b Replace __forceinline with zend_always_inline in win32/ (GH-17482)
`__forceinline` is MSVC specific (and also understood by Clang on
Windows), but the code in win32/ should not be constrained to these
compilers.  Since we already have `zend_always_inline`, we use this
instead.
2025-01-16 15:05:24 +01:00
Christoph M. Becker
6967de563e Simplify ZEND_SIGNED_MULTIPLY_LONG() on Windows (GH-17477)
For Clang, we just need to define the respective macros, since these
built-ins are available in all supported Clang versions (>= 4.0.0,
currently)[1].

For MSVC (and possibly other compilers) we use the respective APIs of
intsafe.h[2] which are available as of Windows 7/Server 2008 R2.

For x86 (and to a lesser extend for ARM64) that should also notably
improve performance.

[1] <https://releases.llvm.org/4.0.0/tools/clang/docs/LanguageExtensions.html>
[2] <https://learn.microsoft.com/en-us/windows/win32/api/intsafe/>
2025-01-16 13:57:07 +01:00
Christoph M. Becker
39f1d253b1 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix potential OOB when checking for trailing spaces
2025-01-16 00:03:16 +01:00
Christoph M. Becker
b702eafbff Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix potential OOB when checking for trailing spaces
2025-01-16 00:02:39 +01:00
Christoph M. Becker
ed8b11188b Fix potential OOB when checking for trailing spaces
If `path_len` is zero, we must not access `path`, let alone try to
subtract `-1` from it.

Since `path` and `path_len` are supposed to come from a `zend_string`,
this is not a security issue.

Closes GH-17471.
2025-01-16 00:01:22 +01:00
Christoph M. Becker
8d6f46d9d2 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix NULL arithmetic during system program execution
2025-01-15 22:55:19 +01:00
Christoph M. Becker
5f42cc9e1c Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix NULL arithmetic during system program execution
2025-01-15 22:54:33 +01:00
Christoph M. Becker
022a5fca91 Fix NULL arithmetic during system program execution
For the first child process execution, `TWG(process)` is `NULL`; we
need to catch that to avoid undefined behavior.

Closes GH-17470.
2025-01-15 22:53:20 +01:00
Gina Peter Banyard
df8ac4af91 ext/pdo_odbc: Do not populate message if there is no driver error (#17478) 2025-01-15 20:46:08 +00:00
David Carlier
951d2f81c7 Merge branch 'PHP-8.4' 2025-01-15 20:37:19 +00:00
David Carlier
6979a7a954 ext/pcntl: Fix pcntl_setcpuaffinity exception type for invalid cpu id.
found while working [on the doc](https://github.com/php/doc-en/pull/4346).

close GH-17474
2025-01-15 20:36:18 +00:00
Gina Peter Banyard
effd3f6212 main: Voidify php_startup_ticks() (#17479)
As it always returns SUCCESS and we ignored the return value anyway
2025-01-15 15:55:42 +00:00
Gina Peter Banyard
b7169a2248 ext/soap: Don't call readfile() userland function (#17432)
* ext/soap: Add some SoapServer tests

* ext/soap: Don't call readfile() userland function

We can perform the operation directly, moreover there is no risk of a user disabling the readfile function and defining their own messing up what we are doing.

* ext/soap: Actually throw a SOAP Fault if the WSDL has disappeared
2025-01-15 14:37:44 +00:00
Christoph M. Becker
7512685767 Use built-ins for addition and subtraction on Windows (GH-17472)
For Clang, we just need to define the respective macros, since these
built-ins are available in all supported Clang versions (>= 4.0.0,
currently)[1].

For MSVC (and possibly other compilers) we use the respective APIs of
intsafe.h[2] which are available as of Windows 7/Server 2008 R2.

This avoids the UB due to signed integer overflow that may happen with
our fallback implementations.

We also drop the superfluous SHORT_MAX definition from pdo_firebird.
This shouldn't be defined unconditionally, but since it is apparently
unused, we remove it altogether.

[1] <https://releases.llvm.org/4.0.0/tools/clang/docs/LanguageExtensions.html>
[2] <https://learn.microsoft.com/en-us/windows/win32/api/intsafe/>
2025-01-15 12:58:12 +01:00
Gina Peter Banyard
abfa377fae ext/pdo: Add FETCH_INTO setting via setAttribute "hack" 2025-01-15 03:02:30 +00:00
Gina Peter Banyard
dfcac15739 ext/pdo: Rename variable, because i is really not descriptive 2025-01-15 03:02:30 +00:00
Dmitry Stogov
4c84ed4d98 Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-01-15 02:46:08 +03:00
Dmitry Stogov
9aaa469f99 Update IR
IR commit: d6d7fc489137aab218b04b59d770b497c5ae3832
2025-01-15 02:45:24 +03:00
Niels Dossche
650e59a1c2 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17428: Assertion failure ext/opcache/jit/zend_jit_ir.c:8940
2025-01-14 22:38:18 +01:00
Niels Dossche
3524702fe1 Fix GH-17428: Assertion failure ext/opcache/jit/zend_jit_ir.c:8940
The code to update the call_level in that case skips the opline itself,
as that's handled by the tail handler, and then wants to set the opline
to the last opline of the block because the code below the switch will
update the call_level for that opline.
However, the test has a block with a single opline (THROW). The block
after that has ZEND_INIT_FCALL, because `i` points to ZEND_INIT_FCALL
now, it erroneously causes the call_level after the switch.

Closes GH-17438.
2025-01-14 22:37:41 +01:00
David Carlier
a4e25839d3 Merge branch 'PHP-8.4' 2025-01-14 18:33:00 +00:00
David Carlier
b1e0176455 Merge branch 'PHP-8.3' into PHP-8.4 2025-01-14 18:32:51 +00:00
David Carlier
e4473abefc Fix GH-17463: SplTempFileObject::ftruncate() segfault on negative length.
close GH-465
2025-01-14 18:32:01 +00:00
Ilija Tovilo
e95b298262 Store prop info name in CG(context) instead of prop info
The prop info is not always available, e.g. when compiling the default
value.

See GH-17378
Closes GH-17464
2025-01-14 17:01:10 +01:00
Christoph M. Becker
634edc8ab3 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix clang compiler detection on Windows
2025-01-14 12:36:58 +01:00
Christoph M. Becker
58628e0cc6 Fix clang compiler detection on Windows
A previous commit[1] left a "debug" statement, which causes clang
builds on Windows to fail always.

[1] <b3d6414b87>

Closes GH-17450.
2025-01-14 12:36:19 +01:00
Ilija Tovilo
0e1fbf97f4 Merge branch 'PHP-8.4'
* PHP-8.4:
  Relax final+private warning for trait methods with inherited final
2025-01-13 16:46:54 +01:00
Ilija Tovilo
3c138641e1 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Relax final+private warning for trait methods with inherited final
2025-01-13 16:46:43 +01:00
Ilija Tovilo
a6a290d541 Relax final+private warning for trait methods with inherited final
Fixes GH-17214
Closes GH-17381
2025-01-13 16:46:01 +01:00
Ilija Tovilo
a06668af30 Merge branch 'PHP-8.4'
* PHP-8.4:
  __PROPERTY__ does not work in all constant expression contexts
2025-01-13 16:43:32 +01:00
Ilija Tovilo
147e9c808c __PROPERTY__ does not work in all constant expression contexts
Fixes GH-17222
Closes GH-17378
2025-01-13 16:42:38 +01:00
Gina Peter Banyard
af1e289332 ext/json: Refactor php_json_encode_serializable_object() to call method directly 2025-01-13 13:46:25 +00:00
Gina Peter Banyard
75a15cf640 ext/json: Use zend_result type instead of int 2025-01-13 13:46:25 +00:00
Christoph M. Becker
aac71904ca Don't pass -fwrapv to clang on Windows (GH-17458)
This is apparently not supported there; the VS supplied clang version
18.1.8, reports:

`clang-cl: warning: unknown argument ignored in clang-cl: '-fwrapv' [-Wunknown-argument]`
2025-01-13 14:10:23 +01:00
Christoph M. Becker
788128aec7 Fix -Wpointer-type-mismatch warning (GH-17453)
`GetProcAddress()` returns a `FARPROC` (aka. `long long (*)()`) which
is not compatible with `void *` per the specs.  However, on Windows
they are, so we silence the warning with a cast.
2025-01-13 13:04:19 +01:00
Christoph M. Becker
1675d32261 Fix printf style issues in Windows specific code (GH-17452)
A couple of calls pass strings as formats (`-Wformat-security`), and
some others mix up types (`-Wformat`).
2025-01-13 11:50:05 +01:00
Christoph M. Becker
26bf239e6d Resolve -Wincompatible-pointer-types warnings (GH-17456)
The phpdbg issue is a real issue, although it's unlikely that harm can
be done due to stack alignment and little-endianess.  The others seem
to be more cosmetic.
2025-01-13 10:54:13 +01:00
Niels Dossche
f99d62013b Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17139: Fix zip_entry_name() crash on invalid entry
2025-01-12 20:42:59 +01:00
Niels Dossche
fd0cabbbe4 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17139: Fix zip_entry_name() crash on invalid entry
2025-01-12 20:42:53 +01:00
Niels Dossche
d08a9e0010 Fix GH-17139: Fix zip_entry_name() crash on invalid entry
Don't increment the refcount, but latter remember the ID to check
afterwards whether the resource still exists.

Replaces GH-17142.
Closes GH-17439.
2025-01-12 20:37:51 +01:00
Christoph M. Becker
c264679fb4 Remove braces around string initializers (#GH-17451)
While MSVC is apparently fine with that, Clang complains about it (`-Wbraced-scalar-init`).
2025-01-12 19:40:15 +01:00
Niels Dossche
e6f42c1ed0 Fix incorrect casts 2025-01-11 10:50:07 +01:00
Gina Peter Banyard
11937b3df7 ext/pdo: Add a test for PDO::FETCH_FUNC with a return by-ref callback (#17425) 2025-01-10 17:27:19 +00:00
Niels Dossche
bdcb3e9e69 Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport fix GH-17307
2025-01-10 18:24:57 +01:00
Niels Dossche
27fbdc16ff Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport fix GH-17307
2025-01-10 18:24:51 +01:00
Niels Dossche
e8fce295bc Backport fix GH-17307
This is a backport of GH-17319 to fix GH-17307 on lower branches.

Closes GH-17424.
2025-01-10 18:24:25 +01:00
Calvin Buckley
97a26ae97a Update OpenBSD glob implementation for Windows (#16948)
We're considering making this used as a glob implementation on POSIX as
well, but first, we should rebase it from the latest version of OpenBSD.

This also adds a new internal header (charclass.h) for glob.

See conversation in GH-15564.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2025-01-10 11:47:28 -04:00
Tim Düsterhus
d8d1cb4195 zend_ast: Print placeholder value when printing ZEND_AST_OP_ARRAY (#17405)
As per the discussion in GH-17120, we are printing a placeholder value only.
The commit history of that PR also includes alternative implementations, should
a different decision be desirable.

Fixes GH-17096
Closes GH-17120
2025-01-10 08:37:17 +01:00
Gina Peter Banyard
8d79ed6b3e ext/pdo: Refactor PDO::FETCH_FUNC to not rely on an FCI on the struct (#17420) 2025-01-09 22:22:52 +00:00