context->notifier->dtor = user_space_stream_notifier_dtor;
}
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "options", sizeof("options"), (void**)&tmp)) {
- parse_context_options(context, *tmp);
+ if (Z_TYPE_PP(tmp) == IS_ARRAY) {
+ parse_context_options(context, *tmp);
+ } else {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter");
+ }
}
return ret;
--- /dev/null
+--TEST--
+bug#44712 (stream_context_set_params segfaults on invalid arguments)
+--FILE--
+<?php
+$ctx = stream_context_get_default();
+stream_context_set_params($ctx, array("options" => 1));
+?>
+--EXPECTF--
+Warning: stream_context_set_params(): Invalid stream/context parameter in %sbug44712.php on line %s
+