1--TEST-- 2Test trampoline for curl option CURLOPT_XFERINFOFUNCTION 3--EXTENSIONS-- 4curl 5--FILE-- 6<?php 7include 'server.inc'; 8$host = curl_cli_server_start(); 9 10class TrampolineTest { 11 public function __call(string $name, array $arguments) { 12 static $done = false; 13 if (!$done) { 14 echo 'Trampoline for ', $name, PHP_EOL; 15 $done = true; 16 } 17 return CURL_PUSH_OK; 18 } 19} 20$o = new TrampolineTest(); 21$callback = [$o, 'trampoline']; 22 23$url = "{$host}/get.inc"; 24$ch = curl_init($url); 25curl_setopt($ch, CURLOPT_NOPROGRESS, 0); 26curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 27curl_setopt($ch, CURLOPT_XFERINFOFUNCTION, $callback); 28echo curl_exec($ch), PHP_EOL; 29 30?> 31--EXPECT-- 32Trampoline for trampoline 33Hello World! 34Hello World! 35