1--TEST--
2Test curl_setopt(_array)() with CURLOPT_SSH_HOSTKEYFUNCTION option
3--EXTENSIONS--
4curl
5--SKIPIF--
6<?php
7$curl_version = curl_version();
8if ($curl_version['version_number'] < 0x075400) {
9    die("skip: blob options not supported for curl < 7.84.0");
10}
11?>
12--FILE--
13<?php
14
15function testOption(CurlHandle $handle, int $option) {
16    try {
17        var_dump(curl_setopt($handle, $option, 'undefined'));
18    } catch (Throwable $e) {
19        echo $e::class, ': ', $e->getMessage(), PHP_EOL;
20    }
21
22    try {
23        var_dump(curl_setopt_array($handle, [$option => 'undefined']));
24    } catch (Throwable $e) {
25        echo $e::class, ': ', $e->getMessage(), PHP_EOL;
26    }
27}
28
29$url = "https://example.com";
30$ch = curl_init($url);
31testOption($ch, CURLOPT_SSH_HOSTKEYFUNCTION);
32
33?>
34--EXPECT--
35TypeError: curl_setopt(): Argument #3 ($value) must be a valid callback for option CURLOPT_SSH_HOSTKEYFUNCTION, function "undefined" not found or invalid function name
36TypeError: curl_setopt_array(): Argument #2 ($options) must be a valid callback for option CURLOPT_SSH_HOSTKEYFUNCTION, function "undefined" not found or invalid function name
37