Commit Graph

63614 Commits

Author SHA1 Message Date
Niels Dossche
b3bce2328f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-12170: Can't use xpath with comments in SimpleXML
2023-09-14 18:42:47 +02:00
Niels Dossche
747335f100 Fix GH-12170: Can't use xpath with comments in SimpleXML
Closes GH-12177.
2023-09-14 18:42:16 +02:00
Ilija Tovilo
85ceb91789
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix filter_var with callback and explicit REQUIRE_SCALAR
2023-09-14 11:49:10 +02:00
Ilija Tovilo
c2fb10d2d2
Fix filter_var with callback and explicit REQUIRE_SCALAR
For some reason, FILTER_CALLBACK disables the FILTER_REQUIRE_SCALAR flag that is
normally set by default. While surprising, this is not something we can change.

However, even specifying FILTER_REQUIRE_SCALAR explicitly does not corrently set
this flag. This is because FILTER_CALLBACK zeroes the flags after they have been
populated from the parameters.

We reverse the checks to make explicitly specifying the flag behave as expected.

Closes GH-12203
2023-09-14 11:48:40 +02:00
Niels Dossche
d1ef22585f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix #52751: XPath processing-instruction() function is not supported.
2023-09-11 00:12:16 +02:00
Niels Dossche
107443b311 Fix #52751: XPath processing-instruction() function is not supported.
Closes GH-12165.
2023-09-11 00:08:29 +02:00
Niels Dossche
6851c7b867 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11878: SQLite3 callback functions cause a memory leak with a callable array
2023-09-09 15:34:38 +02:00
Niels Dossche
07a9d2fb32 Fix GH-11878: SQLite3 callback functions cause a memory leak with a callable array
In this test file, the free_obj handler is called with a refcount of 2,
caused by the fact we do a GC_ADDREF() to increase its refcount while
its refcount is still 1 because the Foo object hasn't been destroyed yet
(due to the cycle caused by the sqlite function callback).
Solve this by introducing a get_gc handler.

Closes GH-11881.
2023-09-09 15:33:50 +02:00
Dmitry Stogov
8fcffa666f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed tracing JIT support for CALLABLE_CONVERT (#12156)
2023-09-08 18:27:31 +03:00
Dmitry Stogov
be0245c756
Fixed tracing JIT support for CALLABLE_CONVERT (#12156) 2023-09-08 18:27:13 +03:00
George Peter Banyard
88ed678935 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ODBC unit tests shouldn't override odbc.ini location
  Fix persistent procedural ODBC connections not getting closed
2023-09-06 01:57:28 +01:00
Calvin Buckley
a648d39297 ODBC unit tests shouldn't override odbc.ini location
`ext/odbc/tests/config.inc` overrides the INIs used for the ODBC driver
manager pointlessly. It's not pointing to some custom PHP test suite
specific one, but the system one in `/etc/odbc(inst).ini`. Which
doesn't necessarily exist, on i.e. NixOS, MacPorts, etc.

Closes GH-12133

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-09-06 01:56:04 +01:00
Calvin Buckley
5a2b251610 Fix persistent procedural ODBC connections not getting closed
Like oci8, procedural ODBC uses an apply function on the hash list to
enumerate persistent connections and close the specific one. However,
this function take zvals, not resources. However, it was getting casted
as such, causing it to interpret the pointer incorrectly. This could
have caused other issues, but mostly manifested as failing to close the
connection even fi it matched.

The function now takes a zval and gets the resource from that. In
addition, it also removes the cast of the function pointer and moves
casting to the function body, to avoid possible confusion like this in
refactors again. It also cleans up style and uses constants in the
function body.

Closes GH-12132

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-09-06 01:55:02 +01:00
George Peter Banyard
c672a06954 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Prevents double call to internal iterator rewind handler
  adds failing test case for #12060
2023-09-05 10:27:33 +01:00
ju1ius
9658d9ada4 adds failing test case for #12060
Signed-off-by: George Peter Banyard <girgias@php.net>
2023-09-05 10:23:22 +01:00
George Peter Banyard
fa0953f49d Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed bug GH-12020: intl_get_error_message() broken after MessageFormatter::formatMessage() fails
2023-09-03 01:04:06 +01:00
George Peter Banyard
a579fa807c Fixed bug GH-12020: intl_get_error_message() broken after MessageFormatter::formatMessage() fails
Passing NULL as the pointer to intl_error* will use the global error stack.
This is what we need to do instead of pushing it onto the temporary format object that is released.
2023-09-03 01:02:46 +01:00
George Peter Banyard
30b550bad5 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix memory leak with failed SQLPrepare
2023-09-02 23:01:08 +01:00
Calvin Buckley
a022ec53bd Fix memory leak with failed SQLPrepare
Closes GH-12095

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-09-02 23:00:06 +01:00
Ilija Tovilo
aff86d68f6
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Fix borked xleak skip on <PHP-8.3
2023-09-01 12:40:07 +02:00
Ilija Tovilo
b21df69848
[skip ci] Fix borked xleak skip on <PHP-8.3
xleak in skipif was only added in PHP 8.3.
2023-09-01 12:39:03 +02:00
Niels Dossche
1cdcbc05b0 Fix GH-11972: RecursiveCallbackFilterIterator regression in 8.1.18
When you do an assignment between two zvals (no, not zval*), you copy
all fields. This includes the additional u2 data. So that means for
example the Z_NEXT index gets copied, which in some cases can therefore
cause a cycle in zend_hash lookups.
Instead of doing an assignment, we should be doing a ZVAL_COPY (or
ZVAL_COPY_VALUE for non-refcounting cases). This avoids copying u2.

Closes GH-12086.
2023-08-30 22:30:59 +02:00
Niels Dossche
262a22740c Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11972: RecursiveCallbackFilterIterator regression in 8.1.18
2023-08-30 22:26:36 +02:00
Ilija Tovilo
10c81039da
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Skip dl() tests on ASAN
2023-08-30 22:25:11 +02:00
Ilija Tovilo
fb0f4215de
Skip dl() tests on ASAN 2023-08-30 22:20:51 +02:00
Niels Dossche
ffd7018fcd Fix GH-11972: RecursiveCallbackFilterIterator regression in 8.1.18
When you do an assignment between two zvals (no, not zval*), you copy
all fields. This includes the additional u2 data. So that means for
example the Z_NEXT index gets copied, which in some cases can therefore
cause a cycle in zend_hash lookups.
Instead of doing an assignment, we should be doing a ZVAL_COPY (or
ZVAL_COPY_VALUE for non-refcounting cases). This avoids copying u2.

Closes GH-12086.
2023-08-30 22:18:33 +02:00
Ilija Tovilo
c128dbdd69
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Fix trailing data in unserialize in soap test
2023-08-28 17:25:07 +02:00
Ilija Tovilo
c8f6ee8c6f
[skip ci] Fix trailing data in unserialize in soap test 2023-08-28 17:24:45 +02:00
Jakub Zelenka
038bbd2d2f
Merge branch 'PHP-8.1' into PHP-8.2 2023-08-28 12:15:33 +01:00
Jakub Zelenka
e1396a314d
Fix flaky file stat tests due to changing nature of atime 2023-08-28 12:14:55 +01:00
Niels Dossche
ab2cc6e50e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Add missing EXTENSIONS section to DOM tests
2023-08-26 18:40:02 +02:00
Niels Dossche
bffc74474b Add missing EXTENSIONS section to DOM tests 2023-08-26 18:37:42 +02:00
Kamil Tekiela
ec82927d25
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix param name in implode() error message
2023-08-24 21:07:18 +01:00
Kamil Tekiela
b1ce1d1f21
Fix param name in implode() error message 2023-08-24 21:05:26 +01:00
Niels Dossche
767697c4ae Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix memory leak when setting an invalid DOMDocument encoding
2023-08-20 14:07:25 +02:00
Niels Dossche
20ac42e1b0 Fix memory leak when setting an invalid DOMDocument encoding
Because the failure path did not release the string, there was a memory
leak.
As the only valid types for this function are IS_NULL and IS_STRING, we
and IS_NULL is always rejected in practice, solve the issue by not using
a function that increments the refcount in the first place.

Closes GH-12002.
2023-08-20 14:05:26 +02:00
David Carlier
f995c0df36 Merge branch 'PHP-8.1' into PHP-8.2 2023-08-19 23:09:41 +01:00
David Carlier
fc8d5c72e5 ext/iconv: fix build for netbsd.
NetBSD still adopts the old iconv signature for buffer inputs.
The next release will too so we can assume it will remain that way for
a while.

Close GH-12001
2023-08-19 23:09:22 +01:00
Kamil Tekiela
6d039d282a
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix failing test on nightly
2023-08-17 18:45:49 +01:00
Kamil Tekiela
ffd398b4fe
Fix failing test on nightly 2023-08-17 18:45:10 +01:00
Ilija Tovilo
9437aa9a8e
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix segfault in format_default_value due to unexpected enum/object
2023-08-17 18:43:49 +02:00
Ilija Tovilo
f78d1d0d10
Fix segfault in format_default_value due to unexpected enum/object
Evaluating constants at comptime can result in arrays that contain objects. This
is problematic for printing the default value of constant ASTs containing
objects, because we don't actually know what the constructor arguments were.
Avoid this by not propagating array constants.

Fixes GH-11937
Closes GH-11947
2023-08-17 18:43:11 +02:00
Kamil Tekiela
06bda99280
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix implicit/explicit port in mysqlnd
2023-08-16 20:33:52 +01:00
Kamil Tekiela
c1103a9772
Fix implicit/explicit port in mysqlnd 2023-08-16 18:59:07 +01:00
George Peter Banyard
02a80c5b82 Fix various bugs related to DNF types
- GH-11958: DNF types in trait properties do not get bound properly
 - GH-11883: Memory leak in zend_type_release() for non-arena allocated DNF types
 - Internal trait bound to userland class would not be arena allocated
 - Property DNF types were not properly deep copied during lazy loading

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
Co-authored-by: ju1ius <jules.bernable@gmail.com>
2023-08-15 15:34:33 +01:00
Niels Dossche
0b516aea25 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix #81992: SplFixedArray::setSize() causes use-after-free
2023-08-14 21:34:04 +02:00
Niels Dossche
b71c6b2c6c Fix #81992: SplFixedArray::setSize() causes use-after-free
Upon resizing, the elements are destroyed from lower index to higher
index. When an element refers to an object with a destructor, it can
refer to a lower (i.e. already destroyed) element, causing a uaf.
Set refcounted zvals to NULL after destroying them to avoid a uaf.

Closes GH-11959.
2023-08-14 21:32:22 +02:00
Kamil Tekiela
7a4b213c1f
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix error checking in mysqlnd
2023-08-10 15:25:37 +01:00
Kamil Tekiela
0d922aa595
Fix error checking in mysqlnd
Closes GH-11925
2023-08-10 15:23:54 +01:00
Ilija Tovilo
1aae59cf43
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix EXPECT for bug52820.phpt on newer curl versions
  Fix curl_basic_009.phpt for newer curl versions
2023-08-10 15:52:14 +02:00