57cbd9a6ce786d93c09cd5f6fb3f0164aa9515fb
[m6w6/ext-http] / tests / gh-issue50.phpt
1 --TEST--
2 segfault with Client::setDebug and Client::dequeue()
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 skip_client_test();
7 skip_online_test();
8 ?>
9 --INI--
10 zend.exception_ignore_args=off
11 --FILE--
12 <?php
13 echo "Test\n";
14
15 $c = new http\Client;
16 $c->enqueue(new http\Client\Request("GET", "http://example.com"));
17
18 $c->setDebug(function(http\Client $c, http\Client\Request $r, $type, $data) {
19 if ($type & http\Client::DEBUG_HEADER) {
20 $c->dequeue($r);
21 }
22 });
23
24 try {
25 $c->send();
26 } catch (Exception $e) {
27 echo $e;
28 }
29
30 ?>
31
32 ===DONE===
33 --EXPECTF--
34 Test
35 http\Exception\RuntimeException: http\Client::dequeue(): Could not dequeue request while executing callbacks in %sgh-issue50.php:9
36 Stack trace:
37 #0 %sgh-issue50.php(9): http\Client->dequeue(Object(http\Client\Request))
38 #1 [internal function]: {closure}(Object(http\Client), Object(http\Client\Request), 18, 'GET / HTTP/1.1%s...')
39 #2 %sgh-issue50.php(14): http\Client->send()
40 #3 {main}
41 ===DONE===