1--TEST--
2Test trampoline for curl option CURLOPT_WRITEFUNCTION
3--EXTENSIONS--
4curl
5--FILE--
6<?php
7
8class TrampolineTest {
9    public function __call(string $name, array $arguments) {
10        echo 'Trampoline for ', $name, PHP_EOL;
11	    return 0;
12    }
13}
14$o = new TrampolineTest();
15$callback = [$o, 'trampoline'];
16
17$log_file = tempnam(sys_get_temp_dir(), 'php-curl-CURLOPT_WRITEFUNCTION-trampoline');
18
19$fp = fopen($log_file, 'w+');
20fwrite($fp, "test");
21fclose($fp);
22
23$ch = curl_init();
24curl_setopt($ch, CURLOPT_WRITEFUNCTION, $callback);
25curl_setopt($ch, CURLOPT_URL, 'file://' . $log_file);
26curl_exec($ch);
27curl_close($ch);
28
29?>
30--CLEAN--
31<?php
32$log_file = tempnam(sys_get_temp_dir(), 'php-curl-CURLOPT_WRITEFUNCTION-trampoline');
33@unlink($log_file);
34?>
35--EXPECT--
36Trampoline for trampoline
37