Commit graph

69253 commits

Author SHA1 Message Date
Niels Dossche
0bed3d5d6d
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for GH-17485
  Cherry-pick lexbor/lexbor@e58e1e8c
  Cherry-pick lexbor/lexbor@ae97abfb
  Cherry-pick lexbor/lexbor@e39083b0
2025-01-17 19:44:16 +01:00
Niels Dossche
0b04061e71
NEWS for GH-17485
Fixes GH-17485.
2025-01-17 19:43:08 +01:00
Niels Dossche
d0981864eb
Cherry-pick lexbor/lexbor@e58e1e8c
Co-authored-by: Alexander Borisov <lex.borisov@gmail.com>
2025-01-17 19:39:58 +01:00
Niels Dossche
a928b66447
Cherry-pick lexbor/lexbor@ae97abfb
Co-authored-by: Alexander Borisov <lex.borisov@gmail.com>
2025-01-17 19:39:12 +01:00
Niels Dossche
4531292ad2
Cherry-pick lexbor/lexbor@e39083b0
Co-authored-by: Alexander Borisov <lex.borisov@gmail.com>
2025-01-17 19:39:12 +01:00
Niels Dossche
5471f117c5
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17500: Segfault with requesting nodeName on nameless doctype
2025-01-17 19:37:19 +01:00
Niels Dossche
525aeff070
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17500: Segfault with requesting nodeName on nameless doctype
2025-01-17 19:37:14 +01:00
Niels Dossche
82d71a82aa
Fix GH-17500: Segfault with requesting nodeName on nameless doctype
Closes GH-17344.
2025-01-17 19:36:47 +01:00
Christoph M. Becker
dd42ebef94
Drop useless and not quite correct cast (GH-17454)
A while ago, the cast has been changed from `u_char *` to `uint8_t *`,
but neither makes sense, and causes Clang to complain with
`-Wcompare-distinct-pointer-types`.
2025-01-17 17:56:52 +01:00
Gina Peter Banyard
8765e9f5e7 ext/zip: Throw a TypeError if the return value of the cancel callback is not an int 2025-01-17 16:48:28 +00:00
Gina Peter Banyard
dccd4af9aa ext/zip: Cancel operation if user callback throws an exception 2025-01-17 16:48:28 +00:00
Gina Peter Banyard
79b9fe334a ext/zip: Convert cancel_callback to FCC 2025-01-17 16:48:28 +00:00
Gina Peter Banyard
76a5804560 ext/zip: Convert progress_callback to FCC 2025-01-17 16:48:28 +00:00
Gina Peter Banyard
08784ed58a ext/zip: Add some tests for methods taking callbakcs 2025-01-17 16:48:28 +00:00
Niels Dossche
72708f298b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17481: UTF-8 corruption in \Dom\HTMLDocument
  Fix GH-17486: Incorrect error line numbers reported in Dom\HTMLDocument::createFromString
2025-01-17 16:25:23 +01:00
Niels Dossche
2952e164a9
Fix GH-17481: UTF-8 corruption in \Dom\HTMLDocument
We need to properly handle the case when we return from having too few
bytes, this needs to be handled separately because the while loop
otherwise just performs a partial byte copy.

Closes GH-17489.
2025-01-17 16:25:08 +01:00
Niels Dossche
21c170c75a
Fix GH-17486: Incorrect error line numbers reported in Dom\HTMLDocument::createFromString
Closes GH-17491.
2025-01-17 16:24:28 +01:00
Derick Rethans
e64f674237
Updated to version 2025.1 (2025a) 2025-01-17 11:53:13 +00:00
Derick Rethans
4333009190
Updated to version 2025.1 (2025a) 2025-01-17 11:53:12 +00:00
Derick Rethans
7da1ea4029
Updated to version 2025.1 (2025a) 2025-01-17 11:53:10 +00:00
Christoph M. Becker
36b8a69009
Drop superfluous enum forward declaration (GH-17455)
Besides that it is not needed, it is not proper C, and Clang warns that
"forward references to 'enum' types are a Microsoft extension"
(`-Wmicrosoft-enum-forward-reference`).
2025-01-17 11:45:58 +01:00
Dennis Snell
f2d8420b1c
Test: grapheme_extract should slide properly past error bytes. (#17404)
grapheme_extract should slide properly past error bytes.

Adds a test to assert that the `$next` parameter of `grapheme_extract()`
points to the next byte offset in the input `$haystack` after accounting
for the moved offset, according to the docs:

> If offset does not point to the first byte of a UTF-8 character,
> the start position is moved to the next character boundary.

It seems that the existing behavior is to find the next grapheme
boundary from the original provided offset, but if the offset doesn’t
point to a valid starting byte, the assigned `$next` value will point
to the byte that was immediately decoded in the same call, leading to
possible infinite loops in user-space code.

```
while ( $at < strlen( $s ) ) {
        $grapheme = grapheme_extract( "\x85PHP", 1, GRAPHEME_EXTR_COUNT, $at, $at );
	// never moves past the second byte, always returns 'P'
}
```
2025-01-17 17:12:41 +09:00
Niels Dossche
d0d8e6867a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17447: Assertion failure when array popping a self addressing variable
2025-01-16 20:29:08 +01:00
Niels Dossche
ae3ab37816
Fix GH-17447: Assertion failure when array popping a self addressing variable
This is the same bug as GH-16957, and fixed in the same way.

Closes GH-17448.
2025-01-16 20:28:51 +01:00
Niels Dossche
a4fa1e728a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Cherry-pick lexbor/lexbor@58c88147
2025-01-16 19:22:55 +01:00
Niels Dossche
ac266c9a05
Cherry-pick lexbor/lexbor@58c88147
See https://github.com/lexbor/lexbor/issues/261.
2025-01-16 19:22:25 +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
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
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
Niels Dossche
e6f42c1ed0
Fix incorrect casts 2025-01-11 10:50:07 +01:00