Skip to content

Fix stream_context_create() rejecting an "options" parameter held by reference - #25719

Open
lacatoire wants to merge 1 commit into
php:PHP-8.4from
lacatoire:fix/standard-context-params-options-reference-8.4
Open

lacatoire wants to merge 1 commit into
php:PHP-8.4from
lacatoire:fix/standard-context-params-options-reference-8.4

Conversation

@lacatoire

@lacatoire lacatoire commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

stream_context_create() and stream_context_set_params() throw a TypeError when the options element of $params is a reference, although it holds a valid array. parse_context_params() checks the type without dereferencing the zval first.

$options = ['http' => ['method' => 'HEAD']];
$params = ['options' => &$options];
var_dump(stream_context_create(null, $params));

Before: TypeError: Invalid stream/context parameter

After: the context is created with the http options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant