1--TEST--
2Test trampoline for curl option CURLOPT_SSH_HOSTKEYFUNCTION
3--EXTENSIONS--
4curl
5--SKIPIF--
6<?php
7$curl_version = curl_version();
8if ($curl_version['version_number'] < 0x075400) {
9    exit("skip: test works only with curl >= 7.84.0");
10}
11exit("skip: cannot properly test CURLOPT_SSH_HOSTKEYFUNCTION");
12?>
13--FILE--
14<?php
15
16class TrampolineTest {
17    public function __call(string $name, array $arguments) {
18        echo 'Trampoline for ', $name, PHP_EOL;
19	    return CURLKHMATCH_MISMATCH;
20    }
21}
22$o = new TrampolineTest();
23$callback = [$o, 'trampoline'];
24
25include 'server.inc';
26$ch = curl_init();
27
28$host = curl_cli_server_start();
29
30var_dump($host);
31//$url = "scp://{$host}/get.inc";
32//$url = "scp://example.com/example.txt";
33curl_setopt($ch, CURLOPT_URL, $url);
34var_dump(curl_setopt($ch, CURLOPT_SSH_HOSTKEYFUNCTION, $callback));
35curl_exec($ch);
36curl_close($ch);
37
38?>
39--EXPECT--
40Trampoline for trampoline
41FAKE
42