Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/standard/streamsfuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ static zend_result parse_context_params(php_stream_context *context, const HashT
zend_fcall_info_cache *fcc = emalloc(sizeof(*fcc));
char *error;
if (!zend_is_callable_ex(tmp, NULL, 0, NULL, fcc, &error)) {
zend_argument_type_error(1, "must be an array with valid callbacks as values, %s", error);
zend_argument_type_error(2, "must have a valid callback for key \"notification\", %s", error);
efree(fcc);
efree(error);
return FAILURE;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
stream_context_set_params() with invalid notification option
stream_context_set_params() and stream_context_create() with invalid notification option
--FILE--
<?php

Expand All @@ -14,8 +14,14 @@ try {
} catch (\Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(stream_context_create(null, ["notification" => "fn_not_exist"]));
} catch (\Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}

?>
--EXPECT--
TypeError: stream_context_set_params(): Argument #1 ($context) must be an array with valid callbacks as values, function "fn_not_exist" not found or invalid function name
TypeError: stream_context_set_params(): Argument #1 ($context) must be an array with valid callbacks as values, class "myclass" not found
TypeError: stream_context_set_params(): Argument #2 ($params) must have a valid callback for key "notification", function "fn_not_exist" not found or invalid function name
TypeError: stream_context_set_params(): Argument #2 ($params) must have a valid callback for key "notification", class "myclass" not found
TypeError: stream_context_create(): Argument #2 ($params) must have a valid callback for key "notification", function "fn_not_exist" not found or invalid function name
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ try {
?>
--EXPECT--
bool(true)
TypeError: stream_context_set_params(): Argument #1 ($context) must be an array with valid callbacks as values, function "fn_not_exist" not found or invalid function name
TypeError: stream_context_set_params(): Argument #2 ($params) must have a valid callback for key "notification", function "fn_not_exist" not found or invalid function name
Loading