Commit graph

68999 commits

Author SHA1 Message Date
Niels Dossche
111072a9f0
Fix GH-18744: PHP 8.4 classList works not correctly if copy HTMLElement by clone keyword.
The $classList property is special in the sense that it's a cached
object instance per (HTML)Element instance. The reason for this design
is because it has the [[SameObject]] IDL attribute.
Cloning in PHP also clones the properties, so it also clones the cached
instance. To solve this, we undo this by resetting the backing storage.

Closes GH-18749.
2025-06-04 18:59:05 +02:00
Niels Dossche
87ff5479fc
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak of X509_STORE in php_openssl_setup_verify() on failure
2025-06-03 23:46:21 +02:00
Niels Dossche
08a9579883
Fix memory leak of X509_STORE in php_openssl_setup_verify() on failure
Closes GH-18750.
2025-06-03 23:45:51 +02:00
Dmitry Stogov
81593cfc6a
Update IR
IR commit: e4343be0082897510c40a1b57baff427c6858878
2025-06-02 09:23:39 +03:00
Niels Dossche
2ebd1258b8
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix ext/enchant test SKIPIFs
2025-06-01 18:21:34 +02:00
Niels Dossche
9187caeab1
Fix ext/enchant test SKIPIFs
The resource check makes no sense, and the is_array() check doesn't
achieve anything. Drop the former, and replace the latter with a !
check.
Discovered while working on GH-18729.

Closes GH-18731.
2025-06-01 18:21:23 +02:00
Tim Düsterhus
3141ad0e40
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix test failures in engine_unsafe_empty_string.phpt (#18727)
2025-06-01 15:45:57 +02:00
Niels Dossche
d8a17ca7c2
Fix test failures in engine_unsafe_empty_string.phpt (#18727)
`/./` matches all characters but newlines, so if `random_bytes`
generates a string with newlines in it, the resulting string is not
empty. Fix this by adding the `s` modifier.
2025-06-01 15:45:36 +02:00
Niels Dossche
cb0b2a27e3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in lookup_loc_range()
2025-06-01 11:38:51 +02:00
Niels Dossche
d39d261b7e
Fix memory leak in lookup_loc_range()
Closes GH-18723.
2025-06-01 11:38:24 +02:00
Gina Peter Banyard
f47a7e8056
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  tests: Fix expectations
2025-05-31 14:46:13 +01:00
Gina Peter Banyard
7f2299c8eb
tests: Fix expectations
Closes GH-18712
2025-05-31 14:45:41 +01:00
Niels Dossche
b83a8d5768
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix reference type confusion and leak in user random engine
2025-05-31 15:38:06 +02:00
Niels Dossche
75cea65c99
Fix reference type confusion and leak in user random engine
Closes GH-18718.

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2025-05-31 15:36:33 +02:00
Niels Dossche
b2d107db4f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak when curl_slist_append() fails
2025-05-31 11:14:13 +02:00
Niels Dossche
d9d991928f
Fix memory leak when curl_slist_append() fails
If curl_slist_append() returns NULL, then the original pointer is lost
and not freed.

Closes GH-18711.
2025-05-31 11:11:54 +02:00
Niels Dossche
c44196143a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix potential NULL deref
2025-05-29 16:57:47 +02:00
Niels Dossche
dd856d5ad9
Fix potential NULL deref
Backported from GH-18697.
2025-05-29 16:57:32 +02:00
Gina Peter Banyard
aae88ac799
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/pgsql: Fix warning not being emittedd when failure to cancel a query
2025-05-29 15:43:52 +01:00
Gina Peter Banyard
40422e9c55
ext/pgsql: Fix warning not being emittedd when failure to cancel a query 2025-05-29 15:42:48 +01:00
Niels Dossche
9e9db0b22f
Update Lexbor patches for non-string attribute
This should fix the final sub-issue of GH-17687.

Closes GH-18691.
2025-05-28 23:34:08 +02:00
Niels Dossche
b8e734a24e
Fix ZEND_NONSTRING attribute for data_file.c
This broke in CI but not on my local machine because of the different
compiler version. This is because there was an issue in GCC [1] that
caused the attribute to not properly work on multidimensional arrays.
This has since been fixed in GCC 15.
Therefore, we guard the attribute with a version check.

[1] https://gcc.gnu.org/cgit/gcc/commit/?id=afb46540d3921e96c4cd7ba8fa2c8b0901759455
2025-05-28 19:48:59 +02:00
Niels Dossche
d6ed107510
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18642: Signed integer overflow in ext/phar fseek
2025-05-28 18:54:15 +02:00
Niels Dossche
61884c3b52
Fix GH-18642: Signed integer overflow in ext/phar fseek
The overflow checking code already existed, but didn't work because the
math was done on signed numbers instead of unsigned numbers.
In the process I also discovered a pre-existing issue that needs to be
fixed (and seems that other stream wrappers can have this issue too).

Closes GH-18644.
2025-05-28 18:53:55 +02:00
Niels Dossche
877663178c
Temporarily drop attribute for fileinfo
The error in CI doesn't reproduce on my system with GCC 15.1.1...
2025-05-27 21:07:15 +02:00
Niels Dossche
e4d2cd47c2
Fix compile error for attribute 2025-05-27 21:00:41 +02:00
Niels Dossche
d5515577d5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport fix for GH-17687
2025-05-27 20:42:12 +02:00
Niels Dossche
fab0a6d75c
Backport fix for GH-17687
Introducing a new attribute macro in lower branches is an ABI break and
not allowed. However, we still need to fix the warnings such that
-Werror builds don't break. So we copy the macro from the master branch
to the C files in the appropriate places.
2025-05-27 20:40:35 +02:00
Niels Dossche
06f592820d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in tidy output handler on error
  Fix leaks with multiple calls to DatePeriod iterator current()
2025-05-26 19:42:20 +02:00
Niels Dossche
b39e17b06c
Fix memory leak in tidy output handler on error
Closes GH-18649.
2025-05-26 19:41:11 +02:00
Niels Dossche
ff2c7dc0f8
Fix leaks with multiple calls to DatePeriod iterator current()
Destroy the old value first. We can't skip recreating the value because
the object may have been changed in between calls.

Closes GH-18624.
2025-05-26 19:40:41 +02:00
DanielEScherzer
cd751f98cb
Reapply GH-17712 with a fix for internal class constants (#18464)
Add recursion protection when emitting deprecation warnings for class
constants, since the deprecation message can come from an attribute that is
using the same constant for the message, or otherwise result in recursion.

But, internal constants are persisted, and thus cannot have recursion
protection. Otherwise, if a user error handler triggers bailout before the
recursion flag is removed then a subsequent request (e.g. with `--repeat 2`)
would start with that flag already applied. Internal constants can presumably
be trusted not to use deprecation messages that come from recursive attributes.

Fixes GH-18463
Fixes GH-17711
2025-05-25 16:43:36 -07:00
David Carlier
78f03cd5f2
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-25 12:53:44 +01:00
David Carlier
5d4846b241
ext/ldap: simplify ldap_connect() workflow, fix url leak.
delaying the object creation only before ldap initialisation.
fix forgotten url freeing on TLS error code path.

close GH-18645
2025-05-25 12:53:28 +01:00
Niels Dossche
83755748fd
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leaks in php_http.c when call_user_function() fails
2025-05-24 21:54:45 +02:00
Niels Dossche
a44e3f442f
Fix memory leaks in php_http.c when call_user_function() fails
retval can be refcounted but is not destroyed.

Closes GH-18638.
2025-05-24 21:54:19 +02:00
Niels Dossche
72127ffac5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak when calloc() fails in php_readline_completion_cb()
2025-05-24 20:39:38 +02:00
Niels Dossche
c9781111e1
Fix memory leak when calloc() fails in php_readline_completion_cb()
Closes GH-18637.
2025-05-24 20:39:14 +02:00
Niels Dossche
64d511ef29
Fix GH-18641: Accessing a BcMath\Number property by ref crashes
The properties are virtual so we need a custom get_property_ptr_ptr
handler.

Closes GH-18637.
2025-05-24 20:38:33 +02:00
Niels Dossche
7efe96d504
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in intl_datetime_decompose()
2025-05-24 14:56:04 +02:00
Niels Dossche
d6836fb345
Fix memory leak in intl_datetime_decompose()
Closes GH-18635.
2025-05-24 14:55:41 +02:00
David Carlier
c00d7e056a
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-22 20:47:25 +01:00
David Carlier
c30bddc18f
Fix GH-18617: socket_import_file_descriptor return check.
to_zval_read_fd_array() helper when retrieving the socket protocol did
not check it.

close GH-18617
2025-05-22 20:46:18 +01:00
Niels Dossche
f9785c230c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add missing filter cleanups on phar failure
2025-05-21 19:48:20 +02:00
Niels Dossche
910aeaafc1
Add missing filter cleanups on phar failure
Closes GH-18609.
2025-05-21 19:47:14 +02:00
Niels Dossche
40e667280b
Fix GH-18597: Heap-buffer-overflow in zend_alloc.c when assigning string with UTF-8 bytes
xmlSave() also can flush in some cases. When the encoding is not
available this can fail for short inputs, resulting in an empty string
which is interned but then wrongly tagged by RETURN_NEW_STR.
Fix this by checking the error condition and switching to RETURN_STR for
defense-in-depth.

This issue also exists on 8.3, but does not crash; however, due to the
different API usage internally I cannot easily fix it on 8.3. There it
gives a partial output.

Closes GH-18606.
2025-05-20 21:32:17 +02:00
Niels Dossche
1e94f3423b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Split off php_set_sock_blocking() and s.is_blocked to a separate function
  Fix missing checks against php_set_blocking() in xp_ssl.c
2025-05-20 08:08:39 +02:00
Niels Dossche
1863014fbd
Split off php_set_sock_blocking() and s.is_blocked to a separate function
This makes it harder to forget the check and keeps the variable and
function call consistent.

Closes GH-18604.
2025-05-20 08:08:06 +02:00
Niels Dossche
31ebb42268
Fix missing checks against php_set_blocking() in xp_ssl.c 2025-05-20 08:07:34 +02:00
Niels Dossche
b2d78ae00c
Backport accel_globals->key leak fix (8.3)
Closes GH-18602.
2025-05-19 22:27:54 +02:00