Skip to content
forked from php/php-src

Conversation

@chopins
Copy link
Owner

@chopins chopins commented Sep 18, 2025

No description provided.

dstogov and others added 30 commits September 2, 2025 10:04
This fixes segfault becuse of UAF in ext/standard/tests/gh14643_longname.phpt
* PHP-8.4:
  Cleanup SSA(s) in case of fatal error during tracing JIT
We need to emit the EXT_STMT opcode before we compile the call, so that we
attach the line number of where the right hand pipe operator starts.

We also do not need to reset the line number anymore.

The following code shows where these EXT_STMTs are introduced.

```
<?php
/* EXT_STMT */ $myString = "<Hello World>";
$result = /* EXT_STMT */ $myString

    |> /* EXT_STMT(!0:$myString) */ \htmlentities(...)

    |>
		/* EXT_STMT($4) */ \str_split(...)

    |> /* EXT_STMT($6) */ (fn($x) => array_map(strtoupper(...), $x))

    |> /* EXT_STMT($9) */ (fn($x) => join( ', ', $x));

/* EXT_STMT */ echo $result, /* EXT_STMT */ "\n";
```
…rnal_encoding()` in tests (#19663)

Moves the usage of `mb_internal_encoding()` to INI section for the tests not testing the encoding/function itself, but the other mbstring/iconv functions.
If (brake->type+1) exeeds 30, we have undefined behavior and won't actually
remove the relevant bit.

See GH-19633
* PHP-8.3:
  Fix date_sunrise() and date_sunset() with partial-hour UTC offset
* PHP-8.4:
  Fix date_sunrise() and date_sunset() with partial-hour UTC offset
The value is temporarily duplicated. While the value is allocated persistently,
it will be freed if the ini value can't be set. This is safe, given the value
has not actually been stored.

Exposed by GH-19619
Closes GH-19671
* PHP-8.3:
  Fix RC assertion in fpm when php_admin_value setting fails
* PHP-8.4:
  Fix RC assertion in fpm when php_admin_value setting fails
* PHP-8.3:
  Stale array iterator pointer
* PHP-8.4:
  Stale array iterator pointer
This code is very similar to code on PHP 8.4 and higher, but the
mitigation is extended to entity references and to attribute children.

Closes GH-19620.
* PHP-8.3:
  Fix GH-19612: Mitigate libxml2 tree dictionary bug
* PHP-8.4:
  Fix GH-19612: Mitigate libxml2 tree dictionary bug
Don't require `@var` with a type when the type can be inferred from a literal
value in the stub file.
The canonical way to do this is via `get_constructor` as `create_object`
may not return NULL.
Range analysis may fail to converge (the process hangs) when the transfer
function zend_inference_calc_range produces a smaller range.

Fix by ensuring that the widening operator zend_inference_widening_meet
allows only widening. This matches the inference rules in figure 13 of the
paper.

Fixes GH-19679
Closes GH-19683
* PHP-8.3:
  Ensure that type widening converges
* PHP-8.4:
  Ensure that type widening converges
* fpm: Improve the error message when FPM is running as root

Co-authored-by: Jakub Zelenka <bukka@php.net>

* fpm: Disable `TEST_FPM_RUN_AS_ROOT` for proc-user-not-set-when-root.phpt

---------

Co-authored-by: Jakub Zelenka <bukka@php.net>
…auses heap corruption

Use the PHP_STREAM_FLAG_NO_FCLOSE flag to prevent closing a stream while
a handler is running. We already do this in some other places as well.
Only handlers that do something with the stream afterwards need changes.

Closes GH-18797.
ndossche and others added 29 commits September 14, 2025 22:11
* PHP-8.4:
  Fix GH-19653: Closure named argument unpacking between temporary closures can cause a crash
* zend_hash: Assert that the `interned` parameter is not a lie

While investigating #19842 I was wondering why non-interned string
didn't cause troubles, until I realized it was the value instead of the key.
Nevertheless it appears useful to check that the key is actually interned as
claimed by the caller to prevent hard-to-find bugs.

* zend_hash: Rename `interned` parameter name to `key_guaranteed_interned`
* PHP-8.3:
  Fix incorrect HASH_FLAG_HAS_EMPTY_IND flag on userland array
* PHP-8.4:
  Fix incorrect HASH_FLAG_HAS_EMPTY_IND flag on userland array
* PHP-8.3:
  Fix GH-19801: address leak when calling var_dump() with recursion in __debugInfo() (#19837)
* PHP-8.4:
  Fix GH-19801: address leak when calling var_dump() with recursion in __debugInfo() (#19837)
This introduces new SAPI callback that runs before post read

Closes GH-19333
Don't access fbc->op_array.refcount on internal function. Don't attempt to cache
ZEND_ACC_USER_ARG_INFO at all, which is only used in
zend_get_closure_invoke_method(). This may reuse arg_info from a temporary
closure, and hence caching would also be unsafe.

Also avoid populating the cache slot for variadic parameters, where the
ZEND_ACC_USER_ARG_INFO is set for the same reason.

Closes GH-19856
* PHP-8.3:
  Fix use-of-uninitialized-value in zend_get_arg_offset_by_name()
* PHP-8.4:
  Fix use-of-uninitialized-value in zend_get_arg_offset_by_name()
This prevents the implementations from going out of sync, causing bugs like
#19813.
* uri: Add `UriError`

* uri: Throw `UriError` for unexpected failures in uri_parser_rfc3986

This is a follow-up for #19779 which updated the error *messages*
for the non-syntax errors, but did not update the exception class, still
implying it's related to invalid URIs.

Given that we don't know ourselves if these are reachable in practice, they are
cannot be meaningfully handled by a user of PHP. Thus this should be a `Error`
according to our exception policy.

* uri: Throw `UriError` when unable to recompose URIs

* uri: Throw `UriError` when unable to read component

* NEWS
Fixes #19823 and makes the deprecation more reliable by triggering
even when `$_SERVER` is not accessed.
@chopins chopins merged commit 32996a4 into chopins:master Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.