{"action":"opened","issue":{"url":"https://api.github.com/repos/m6w6/ext-http/issues/50","repository_url":"https://api.github.com/repos/m6w6/ext-http","labels_url":"https://api.github.com/repos/m6w6/ext-http/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/m6w6/ext-http/issues/50/comments","events_url":"https://api.github.com/repos/m6w6/ext-http/issues/50/events","html_url":"https://github.com/m6w6/ext-http/issues/50","id":168058689,"number":50,"title":"http\\Client::dequeue() within http\\Client::setDebug() causes segfault","user":{"login":"MaikWagner","id":7701966,"avatar_url":"https://avatars.githubusercontent.com/u/7701966?v=3","gravatar_id":"","url":"https://api.github.com/users/MaikWagner","html_url":"https://github.com/MaikWagner","followers_url":"https://api.github.com/users/MaikWagner/followers","following_url":"https://api.github.com/users/MaikWagner/following{/other_user}","gists_url":"https://api.github.com/users/MaikWagner/gists{/gist_id}","starred_url":"https://api.github.com/users/MaikWagner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaikWagner/subscriptions","organizations_url":"https://api.github.com/users/MaikWagner/orgs","repos_url":"https://api.github.com/users/MaikWagner/repos","events_url":"https://api.github.com/users/MaikWagner/events{/privacy}","received_events_url":"https://api.github.com/users/MaikWagner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-28T10:04:13Z","updated_at":"2016-07-28T10:04:13Z","closed_at":null,"body":"We want to abort curl requests as soon as possible in case the resolved IP address is in our blacklist, however using the http\\Client::dequeue() (http\\Client::reset()) method from the setDebug()-callback causes a segmentation fault. We are using pecl_http 3.1.0 (master) with PHP 7.0.9 and curl 7.29.0.\r\n\r\nTo demonstrate the problem, I took the example from #35 and used the http\\Client::dequeue() method within the setDebug():\r\n\r\n```php\r\n<?php\r\n$c = new http\\Client;\r\n$c->enqueue(new http\\Client\\Request(\"GET\", \"https://m6w6.name\"));\r\n\r\n$c->setDebug(function(http\\Client $c, http\\Client\\Request $r, int $type, string $data) {\r\n    if ($type & http\\Client::DEBUG_HEADER) {\r\n        $c->dequeue($r);\r\n    }\r\n});\r\n\r\n$c->send();\r\n```\r\n\r\nWith gdb I get this backtrace:\r\n```\r\n#0  0x00007ffff7754c7a in multi_runsingle (multi=multi@entry=0xda6bb0, now=..., easy=easy@entry=0xdbe1b0) at multi.c:1239\r\n#1  0x00007ffff7755121 in curl_multi_perform (multi_handle=0xda6bb0, running_handles=running_handles@entry=0x7ffff14b9148) at multi.c:1723\r\n#2  0x00007fffe859fe5e in php_http_client_curl_once (h=0x7ffff1477840) at pecl_http-3.1.0-dev/src/php_http_client_curl.c:2268\r\n#3  php_http_client_curl_exec (h=0x7ffff1477840) at pecl_http-3.1.0-dev/src/php_http_client_curl.c:2285\r\n#4  0x00007fffe859a1ef in zim_HttpClient_send (execute_data=0x7ffff1414130, return_value=0x7ffff1414120) at pecl_http-3.1.0-dev/src/php_http_client.c:867\r\n#5  0x00000000006db70b in ZEND_DO_FCALL_SPEC_HANDLER () at php-7.0.9/Zend/zend_vm_execute.h:842\r\n#6  0x00000000006a1f7b in execute_ex (ex=<optimized out>) at php-7.0.9/Zend/zend_vm_execute.h:414\r\n#7  0x00000000006fddc3 in zend_execute (op_array=0x7ffff1484000, op_array@entry=0x7ffff1414030, return_value=return_value@entry=0x0)\r\n    at php-7.0.9/Zend/zend_vm_execute.h:458\r\n#8  0x000000000065fcc0 in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=2) at php-7.0.9/Zend/zend.c:1427\r\n#9  0x00000000005fa05b in php_execute_script (primary_file=primary_file@entry=0x7fffffffcec0) at php-7.0.9/main/main.c:2510\r\n#10 0x00000000006ffb3f in do_cli (argc=2, argv=0xc28ee0) at php-7.0.9/sapi/cli/php_cli.c:974\r\n#11 0x000000000042d45b in main (argc=2, argv=0xc28ee0) at php-7.0.9/sapi/cli/php_cli.c:1344\r\n```"}}
{"actor":{"display_login":"MaikWagner"}}