1
0
mirror of https://github.com/php/php-src.git synced 2026-04-30 03:33:17 +02:00
Commit Graph

72247 Commits

Author SHA1 Message Date
Ilija Tovilo cb51737f41 Merge branch 'PHP-8.5'
* PHP-8.5:
  Tweak zend.max_allowed_stack_size for gh20836_stack_limit.phpt
2026-02-03 00:55:05 +01:00
Ilija Tovilo 9e96c5ff39 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Tweak zend.max_allowed_stack_size for gh20836_stack_limit.phpt
2026-02-03 00:54:56 +01:00
Ilija Tovilo 1f57d04648 Tweak zend.max_allowed_stack_size for gh20836_stack_limit.phpt
Fixes GH-21086
2026-02-03 00:54:25 +01:00
Khaled Alam 32bd33983d Remove unreachable code after zend_error_noreturn calls (GH-20983) 2026-02-02 14:14:15 +01:00
Ayesh Karunaratne 6419618f54 ext/standard: update array_filter $mode param default value to ARRAY_FILTER_USE_VALUE
In GH-15647, the `array_filter` function was changed to throw a
`ValueError` exception when the `$mode` parameter receives an
invalid.

Additionally, it declares a new `ARRAY_FILTER_USE_VALUE`, assigned
(`int 1`) to it.

This changes the default value of the `array_filter` function's
`$mode` parameter to use the new constant, changing it from
`int $mode = 0` to `int $mode = ARRAY_FILTER_USE_KEY)`.

Closes GH-21100.
2026-02-01 10:35:32 +07:00
Ilija Tovilo 6173a9a109 VAR|TMP overhaul (GH-20628)
The aim of this PR is twofold:

- Reduce the number of highly similar TMP|VAR handlers
- Avoid ZVAL_DEREF in most of these cases

This is achieved by guaranteeing that all zend_compile_expr() calls, as well as
all other compile calls with BP_VAR_{R,IS}, will result in a TMP variable. This
implies that the result will not contain an IS_INDIRECT or IS_REFERENCE value,
which was mostly already the case, with two exceptions:

- Calls to return-by-reference functions. Because return-by-reference functions
  are quite rare, this is solved by delegating the DEREF to the RETURN_BY_REF
  handler, which will examine the stack to check whether the caller expects a
  VAR or TMP to understand whether the DEREF is needed. Internal functions will
  also need to adjust by calling the zend_return_unwrap_ref() function.

- By-reference assignments, including both $a = &$b, as well as $a = [&$b]. When
  the result of these expressions is used in a BP_VAR_R context, the reference
  is unwrapped via a ZEND_QM_ASSIGN opcode beforehand. This is exceptionally
  rare.

Closes GH-20628
2026-01-31 19:44:56 +01:00
Niels Dossche 0f4f73a254 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-21077: Accessing Dom\Node::baseURI can throw TypeError
2026-01-30 18:14:24 +01:00
Niels Dossche d54e5106b0 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21077: Accessing Dom\Node::baseURI can throw TypeError
2026-01-30 18:14:19 +01:00
Niels Dossche d73b2f782e Fix GH-21077: Accessing Dom\Node::baseURI can throw TypeError
Prior to this patch there was a common read handler, and it relied on
the dom class set in the intern document. However, Dom\Implementation
allows creating DTDs unassociated with a document, so we can't rely on
an intern document and the check fails. This causes the ZVAL_NULL() path
to be taken.
To solve this, just split the handler.

Closes GH-21082.
2026-01-30 18:13:55 +01:00
Khaled Alam d03d69a88a Remove duplicate #include statements (#21085)
* Remove duplicate #include statements across the codebase.

* feat: Restore conditional/unconditional include pairs in lscriu.c
2026-01-30 16:37:13 +01:00
Alexandre Daubois e4935cf601 Merge branch 'PHP-8.5'
* PHP-8.5:
  Core: fix missing deprecation when accessing null array key with JIT (#20883)
2026-01-30 16:19:57 +01:00
Alexandre Daubois 4a6e6077ef Core: fix missing deprecation when accessing null array key with JIT (#20883) 2026-01-30 16:18:33 +01:00
cui 7fed075ba6 [skip ci] typo: sucess* to success* (GH-21092) 2026-01-30 14:28:48 +01:00
David Carlier 4876148bbe Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-21023: CURLOPT_XFERINFOFUNCTION with invalid callback crash.
2026-01-30 13:10:35 +00:00
David Carlier 2b89919a5d Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21023: CURLOPT_XFERINFOFUNCTION with invalid callback crash.
2026-01-30 13:10:27 +00:00
David Carlier b156471a30 Fix GH-21023: CURLOPT_XFERINFOFUNCTION with invalid callback crash.
we check the FCC is properly initialised beforehand in its handler.

close GH-21025
2026-01-30 13:09:44 +00:00
Arshid 9580d47898 ext/ftp: Use STANDARD_MODULE_HEADER instead of STANDARD_MODULE_HEADER_EX (#21088) 2026-01-30 09:05:43 +00:00
David CARLIER ce798afac3 Fix GH-21058: error_log() crash on null destination argument. (#21064)
we preserve the lower branches behavior by letting php_stream_open_wrapper_ex
handling the null path and propagating the exception.

close GH-21064
2026-01-29 19:49:45 +00:00
Arshid 5ce36453d6 [skip ci] Use STANDARD_MODULE_HEADER for ext-date (GH-21080) 2026-01-29 17:19:14 +01:00
Ilija Tovilo db24ca5926 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix segfault when preloading constant AST closure
2026-01-29 13:31:38 +01:00
Ilija Tovilo 2f2b421a48 Fix segfault when preloading constant AST closure
Fixes GH-21059
Closes GH-21071
2026-01-29 13:30:41 +01:00
Daniel Scherzer 22c618ee00 ext/session: use STANDARD_MODULE_HEADER for module entry (#21066)
Now that the extension has no dependencies (#21060), no need to use
`STANDARD_MODULE_HEADER_EX`.
2026-01-28 20:46:11 -08:00
Calvin Buckley 4d5b651e90 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix regression with header removal removing whole prefixes (#21020)
2026-01-28 16:50:26 -04:00
Calvin Buckley cd32c597a7 Fix regression with header removal removing whole prefixes (#21020)
* Fix regression with header removing removing whole prefixes

The header removal code looked for the colon for key-value at the wrong
place, so it would overzealously remove headers. Tweak that condition,
and make the alternative condition only active if it's set (with the
remove prefix op case).

Fixes GH-21018.

* avoid reading past the actual length

* Rename variable to be more clear
2026-01-28 16:50:06 -04:00
David Carlier b16e534f9a Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-21055: Pdo/Pgsql typo for GSS negotiation connection status attribute.
2026-01-28 18:15:04 +00:00
David Carlier 00466a068e Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21055: Pdo/Pgsql typo for GSS negotiation connection status attribute.
2026-01-28 18:14:53 +00:00
Loïc Saos 3037526810 Fix GH-21055: Pdo/Pgsql typo for GSS negotiation connection status attribute.
close GH-21057
2026-01-28 18:12:08 +00:00
Peter Kokot 65fd4d83bc Remove ext/spl dependency from ext/session (#21060)
This is a follow-up of 668606816f
(GH-21001).

The SPL extension is no longer needed to be listed among dependencies.
The https://bugs.php.net/53141 is tested in
ext/session/tests/bug53141.phpt.

Additionally:
- Added missing inclusion guards to Zend/zend_autoload.h
2026-01-28 16:25:40 +00:00
Gina Peter Banyard 668606816f Zend: move class autoloading from SPL to Zend (#21001)
The primary motivation for this change is that this sort of functionality should reside in core and not in an extension.
The reason being is that this causes issues in regard to extension dependencies and resolution,
something that prevents GH-14544.
2026-01-28 01:57:30 +00:00
Vincent Langlet 74b8fdb95b Fix getPartsIterator stub (#21003) 2026-01-26 20:37:23 +01:00
Niels Dossche a7447c1447 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-21041: Dom\HTMLDocument corrupts closing tags within scripts
2026-01-26 19:20:47 +01:00
Niels Dossche d2cd73a4b4 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21041: Dom\HTMLDocument corrupts closing tags within scripts
2026-01-26 19:20:42 +01:00
Alexander Borisov 56e5a80c44 Fix GH-21041: Dom\HTMLDocument corrupts closing tags within scripts 2026-01-26 19:20:10 +01:00
Jorg Adam Sowa 6d95a2238d ext/standard: validate mode in array_filter() (#15647)
And add the missing ARRAY_FILTER_USE_VALUE for the default case.
2026-01-26 16:02:15 +00:00
Tim Düsterhus 6a17febe6c zend_compile: Fix array_map() optimization (#21016)
* zend_compile: Fix handling of PFA syntax in array_map() optimization

PFA is not implemented and the syntax is rejected at compile-time, thus it was
assumed the assertion would be unreachable. However the check for PFA syntax
happens after compiling special functions, making it reachable. Fix this by
gracefully returning FAILURE which will then correctly emit the error during
the compilation of the normal call.

Fixes php/php-src#20991.

* zend_compile: Fix array_map() optimization for dynamic function names

Fixes php/php-src#20990.

* zend_compile: Adjust array_map() optimization after review feedback
2026-01-26 08:59:30 +01:00
Gina Peter Banyard b40f38bc9a Merge branch 'PHP-8.5'
* PHP-8.5:
  ext/dba/tests/dba_db4_018.phpt: fix typo (#20938)
2026-01-24 11:39:28 +00:00
Gina Peter Banyard 964d087227 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/dba/tests/dba_db4_018.phpt: fix typo (#20938)
2026-01-24 11:39:06 +00:00
Michael Orlitzky 3053a039ff ext/dba/tests/dba_db4_018.phpt: fix typo (#20938)
We expect "objects" but print "object".

Gentoo-bug: https://bugs.gentoo.org/968656
2026-01-24 11:38:45 +00:00
Niels Dossche fb5d4784fe Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix crash in openssl_x509_parse() when X509_NAME_oneline() fails
  Fix crash when in openssl_x509_parse() when i2s_ASN1_INTEGER() fails
2026-01-23 15:00:22 +01:00
Niels Dossche 2c08d9a627 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix crash in openssl_x509_parse() when X509_NAME_oneline() fails
  Fix crash when in openssl_x509_parse() when i2s_ASN1_INTEGER() fails
2026-01-23 14:59:35 +01:00
Niels Dossche 62afc7a2fa Fix crash in openssl_x509_parse() when X509_NAME_oneline() fails
The X509_NAME_oneline() function can return NULL, which will cause a
crash when the string length is computed via add_assoc_string().

Closes GH-21010.
2026-01-23 14:59:08 +01:00
Niels Dossche c2eadb4922 Fix crash when in openssl_x509_parse() when i2s_ASN1_INTEGER() fails
The X509_NAME_oneline() function can return NULL,
which will cause a crash when the string length is computed via add_assoc_string().

Closes GH-21011.
2026-01-23 14:58:39 +01:00
Niels Dossche 61845cc016 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix memory leaks when sk_X509_new_null() fails
2026-01-22 22:47:51 +01:00
Niels Dossche 7d4e430435 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix memory leaks when sk_X509_new_null() fails
2026-01-22 22:47:35 +01:00
Niels Dossche 7754eafb1f Fix memory leaks when sk_X509_new_null() fails
In a lot of places the return value is not checked, and when the
function fails the code continues execution. However, this means that
operations on the stack fail and will cause memory leaks on the objects
that weren't pushed.

We also notice an inconsistency in how these failures are handled.
For example, in one place we explicitly have a fatal error
`php_error_docref(NULL, E_ERROR, "Memory allocation failure");`
but this is the only place to do so.

Closes GH-20957.
2026-01-22 22:37:14 +01:00
Arnaud Le Blanc 65b4073922 Include the actual stub name in generated arginfo headers (#20993) 2026-01-21 20:57:00 +01:00
Ilija Tovilo 337cb3712d Merge branch 'PHP-8.5'
* PHP-8.5:
  [skip ci] Reduce zend.max_allowed_stack_size in gh20840.phpt
2026-01-21 17:35:56 +01:00
Ilija Tovilo 6c57b4b49a Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  [skip ci] Reduce zend.max_allowed_stack_size in gh20840.phpt
2026-01-21 17:35:49 +01:00
Ilija Tovilo 4367315183 [skip ci] Reduce zend.max_allowed_stack_size in gh20840.phpt
This test still fails on i386 Windows with "Allowed memory size of %d bytes
exhausted" because the output buffer grows too big. My first intuition was to
add a chunk_size to ob_start, but this won't work if the output buffer is
flushed deep into the call stack, causing a premature or just a second stack
limit error. So, reduce the stack size in an attempt to produce less output.
2026-01-21 17:32:01 +01:00
Ilija Tovilo 95f7e30f4c [skip ci] Fix tmps= count in variation build
Observers add an extra tmp, breaking the expected output.
2026-01-21 16:57:05 +01:00