{"action":"opened","issue":{"url":"https://api.github.com/repos/krakjoe/pthreads/issues/511","labels_url":"https://api.github.com/repos/krakjoe/pthreads/issues/511/labels{/name}","comments_url":"https://api.github.com/repos/krakjoe/pthreads/issues/511/comments","events_url":"https://api.github.com/repos/krakjoe/pthreads/issues/511/events","html_url":"https://github.com/krakjoe/pthreads/issues/511","id":114390935,"number":511,"title":"pthreads detected an attempt to connect to an object which has already been destroyed","user":{"login":"yinliangc","id":15515064,"avatar_url":"https://avatars.githubusercontent.com/u/15515064?v=3","gravatar_id":"","url":"https://api.github.com/users/yinliangc","html_url":"https://github.com/yinliangc","followers_url":"https://api.github.com/users/yinliangc/followers","following_url":"https://api.github.com/users/yinliangc/following{/other_user}","gists_url":"https://api.github.com/users/yinliangc/gists{/gist_id}","starred_url":"https://api.github.com/users/yinliangc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yinliangc/subscriptions","organizations_url":"https://api.github.com/users/yinliangc/orgs","repos_url":"https://api.github.com/users/yinliangc/repos","events_url":"https://api.github.com/users/yinliangc/events{/privacy}","received_events_url":"https://api.github.com/users/yinliangc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-31T06:33:08Z","updated_at":"2015-10-31T06:33:08Z","closed_at":null,"body":"<?php\r\n\r\nclass TestThread extends Thread\r\n{\r\n\r\n    public $url;\r\n\r\n    public $data;\r\n\r\n    public function __construct($url)\r\n    {\r\n        $this->url = $url;\r\n    }\r\n\r\n    public function run()\r\n    {\r\n        $this->data = curlGet($this->url);\r\n    }\r\n}\r\n\r\nfunction curlGet($url)\r\n{\r\n    $ch = curl_init();\r\n    curl_setopt($ch, CURLOPT_URL, $url);\r\n    curl_setopt($ch, CURLOPT_TIMEOUT, 30);\r\n    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);\r\n    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\r\n    $curl_body['content'] = curl_exec($ch);    // display \"pthreads detected an attempt to connect to an object which has already been destroyed error \" in php 7 and pthreads 3.0.08, but works well in php 5.6 and pthreads 2.0.10\r\n    \r\n  //  $curl_body = curl_exec($ch);   // if use this in php 7 and pthreads 3.0.08 works well\r\n    curl_close($ch);\r\n    return $curl_body;\r\n}\r\n\r\nfunction createThread($urlArray)\r\n{\r\n    foreach ($urlArray as $i => $url) {\r\n        $threadArray[$i] = new TestThread($url);\r\n        $threadArray[$i]->start();\r\n    }\r\n    \r\n    foreach ($threadArray as $key => $thread) {\r\n        if ($thread->join()) {\r\n            $threadDataArray[$key] = $thread->data;\r\n        }\r\n    }\r\n    return $threadDataArray;\r\n}\r\n\r\nfor ($i = 0; $i < 50; $i ++) {\r\n    $url = 'http://127.0.0.1';\r\n    $urlArray[] = $url;\r\n}\r\n\r\n$data = createThread($urlArray);\r\n\r\nprint_r($data);\r\n\r\n?>\r\n\r\nif i use     $curl_body['content'] = curl_exec($ch);    it would display \"pthreads detected an attempt to connect to an object which has already been destroyed error \r\nbut  $curl_body = curl_exec($ch);   works well, what's wrong.\r\n\r\nis it a bug ?  $curl_body['content'] = curl_exec($ch);   and $curl_body = curl_exec($ch);  works well in pthreads 2.0.10,  what's wrong ?"}}