1--TEST-- 2Test CURL_READFUNC_PAUSE and curl_pause() 3--EXTENSIONS-- 4curl 5--FILE-- 6<?php 7include 'server.inc'; 8$host = curl_cli_server_start(); 9 10class Input { 11 private static $RESPONSES = [ 12 'Foo bar ', 13 CURL_READFUNC_PAUSE, 14 'baz qux', 15 null 16 ]; 17 private int $res = 0; 18 public function __invoke($ch, $hReadHandle, $iMaxOut) 19 { 20 return self::$RESPONSES[$this->res++]; 21 } 22} 23 24$inputHandle = fopen(__FILE__, 'r'); 25 26$ch = curl_init(); 27curl_setopt($ch, CURLOPT_URL, "{$host}/get.inc?test=input"); 28curl_setopt($ch, CURLOPT_UPLOAD, 1); 29curl_setopt($ch, CURLOPT_READFUNCTION, new Input); 30curl_setopt($ch, CURLOPT_INFILE, $inputHandle); 31curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 32 33$mh = curl_multi_init(); 34curl_multi_add_handle($mh, $ch); 35do { 36 $status = curl_multi_exec($mh, $active); 37 curl_pause($ch, CURLPAUSE_CONT); 38 if ($active) { 39 usleep(100); 40 curl_multi_select($mh); 41 } 42} while ($active && $status == CURLM_OK); 43 44echo curl_multi_getcontent($ch); 45?> 46--EXPECT-- 47string(15) "Foo bar baz qux" 48