Commit Graph

63636 Commits

Author SHA1 Message Date
David Carlier
36f78862c8 Merge branch 'PHP-8.1' into PHP-8.2 2023-09-23 20:12:41 +01:00
David Carlier
a80db7b52a Fix GH-12282: IntlDateFormatter::construct should throw an exception is the locale field has an invalid value.
Close GH-12282
2023-09-23 20:12:13 +01:00
Ilija Tovilo
88f6b5288f
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  support running testsuite with negative niceness (#11481)
2023-09-22 11:33:36 +02:00
divinity76
4f044e9238
support running testsuite with negative niceness (#11481)
* support running testsuite with negative niceness

a bug in the regex would break getNice() if the current niceness was negative, which would make the whole test fail.

Previously:
this would fail:
time sudo nice --adjustment=-19 ./php run-tests.php -j$(nproc) -x --offline ext/standard/tests/general_functions/proc_nice_basic.phpt --color --show-all

and this would work: 
time sudo ./php run-tests.php -j$(nproc) -x --offline ext/standard/tests/general_functions/proc_nice_basic.phpt --color --show-all

* Update ext/standard/tests/general_functions/proc_nice_basic.phpt

Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>

---------

Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>
2023-09-22 11:33:25 +02:00
Ilija Tovilo
645ea22390
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix getpriority test with negative return value
2023-09-22 10:26:01 +02:00
Ilija Tovilo
181598d403
Fix getpriority test with negative return value
Negative return values are valid and denote higher priority.

https://man7.org/linux/man-pages/man2/setpriority.2.html
2023-09-22 10:25:15 +02:00
Niels Dossche
2aea9be3ea Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix memory leak when calling xml_parse_into_struct() twice
  Fix return type of stub of xml_parse_into_struct()
2023-09-21 19:51:14 +02:00
Niels Dossche
30f26b587a Fix memory leak when calling xml_parse_into_struct() twice
Closes GH-12254.
2023-09-21 19:49:46 +02:00
Niels Dossche
b1d9a8d321 Fix return type of stub of xml_parse_into_struct()
Closes GH-12253.
2023-09-21 19:48:40 +02:00
David Carlier
63150dc2b1 Merge branch 'PHP-8.1' into PHP-8.2 2023-09-21 05:35:04 +01:00
David Carlier
84c4336aa3 Fix GH-12243, segfault on IntlDateFormatter::construct with dateType set to UDAT_PATTERN but not timeType.
udat_open expects its timeStyle's argument to be set to UDAT_PATTERN
 when dateStyle is, regardless if there an actual pattern or not.

Close GH-12245
2023-09-21 05:34:49 +01:00
Niels Dossche
84fae4a160 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-12215: Module entry being overwritten causes type errors in ext/dom (<= PHP 8.3)
  Fix bug #55098: SimpleXML iteration produces infinite loop
2023-09-20 20:58:08 +02:00
Niels Dossche
da6097ffc8 Fix GH-12215: Module entry being overwritten causes type errors in ext/dom (<= PHP 8.3)
When we try to load an extension multiple times, we still overwrite the
type, module number, and handle. If the module number is used to
indicate module boundaries (e.g. in reflection and in dom, see e.g.
dom_objects_set_class_ex), then all sorts of error can happen.

In the case of ext/dom, OP's error happens because the following
happens:
- The property handler is set up incorrectly in
  dom_objects_set_class_ex() because the wrong module number is
  specified. The class highest in the hierarchy is DOMNode, so the
  property handler is incorrectly set to that of DOMNode instead of
  DOMDocument.
- The documentElement property doesn't exist on DOMNode, it only exists
  on DOMDocument, so it tries to read using zend_std_read_property().
  As there is no user property called documentElement, that read
  operation returns an undef value.
  However, the type is still checked, resulting in the strange exception.

Closes GH-12219.
2023-09-20 20:57:04 +02:00
Niels Dossche
1a4e401bf0 Fix bug #55098: SimpleXML iteration produces infinite loop
Closes GH-12247.
2023-09-20 20:54:53 +02:00
Niels Dossche
15bbae7bc9 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11956: PCRE regular expressions with JIT enabled gives different result
2023-09-18 20:13:45 +02:00
Niels Dossche
d61efdfe97 Fix GH-11956: PCRE regular expressions with JIT enabled gives different result
The code in the attached test used to work correctly in PHP 8.0, but not
in 8.1+. This is because PHP 8.1+ uses a more modern version of pcre2
than PHP 8.0, and that pcre2 versions has a regression.

While upgrading pcre2lib seems to be only done for the master branch, it
is possible to backport upstream fixes to stable branches. This has been
already done in the past in for JIT regressions [1], so it is not
unprecedented.

We backport the upstream pcre2 fix [2].

[1] https://github.com/php/php-src/commit/788a701e222
[2] https://github.com/PCRE2Project/pcre2/pull/135

Closes GH-12108.
2023-09-18 20:11:56 +02:00
Niels Dossche
f4f34b6e5a Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-12208: SimpleXML infinite loop when a cast is used inside a foreach
2023-09-17 16:34:38 +02:00
Niels Dossche
486276f0f9 Fix GH-12208: SimpleXML infinite loop when a cast is used inside a foreach
Closes GH-12229.
2023-09-17 16:33:32 +02:00
Niels Dossche
5df473d2c7 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-12223: Entity reference produces infinite loop in var_dump/print_r
  Fix GH-12192: SimpleXML infinite loop when getName() is called within foreach
  Fix GH-12186: segfault copying/cloning a finalized HashContext
2023-09-16 21:24:20 +02:00
Niels Dossche
39a9e561f9 Fix GH-12223: Entity reference produces infinite loop in var_dump/print_r
Closes GH-12223.
2023-09-16 21:19:58 +02:00
Niels Dossche
4d888cf53f Fix GH-12192: SimpleXML infinite loop when getName() is called within foreach
This happens because getName() resets the iterator to the start because
it overwrites the iterator data.
We add a version of get_first_node that does not overwrite the iterator
data.

Closes GH-12193.
2023-09-16 21:19:28 +02:00
Max Semenik
10f5a06d3c Fix GH-12186: segfault copying/cloning a finalized HashContext
Closes GH-12186.
Closes GH-12187.
2023-09-16 21:18:27 +02:00
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