[php-src] PR #25556: Fix the argument named by the TypeError of an invalid stream context notification callback
| From: | lacatoire | Date: | Wed, 18 Nov 2026 13:45:42 +0000 |
| Subject: | [php-src] PR #25556: Fix the argument named by the TypeError of an invalid stream context notification callback | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40774@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25556
Author: lacatoire
The
TypeError for a notification parameter that is not callable names
argument #1 in both stream_context_create() and
stream_context_set_params(), although the value comes from $params, which
is argument #2 of both. It also describes the value as an array of callbacks, while it is a single
callable.
To reproduce:
```php
try {
stream_context_create(null, ['notification' => 'nope']);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
stream_context_set_params(stream_context_create(), ['notification' =>
'nope']);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
```
Before (8.5.12):
```
TypeError: stream_context_create(): Argument #1 ($options) must be an array with valid callbacks as
values, function "nope" not found or invalid function name
TypeError: stream_context_set_params(): Argument #1 ($context) must be an array with valid callbacks
as values, function "nope" not found or invalid function name
```
After:
```
TypeError: stream_context_create(): Argument #2 ($params) must have a valid callback for key
"notification", function "nope" not found or invalid function name
TypeError: stream_context_set_params(): Argument #2 ($params) must have a valid callback for key
"notification", function "nope" not found or invalid function name
```