|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #67506 closures as callbacks
Submitted: 2014-06-24 14:46 UTC Modified: 2014-09-18 20:07 UTC
From: very-hot at gmx dot at Assigned: krakjoe (profile)
Status: Closed Package: pthreads (PECL)
PHP Version: 5.5.13 OS: Win 8.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: very-hot at gmx dot at
New email:
PHP Version: OS:


 [2014-06-24 14:46 UTC] very-hot at gmx dot at
PHP-Version 5.5.11

class Thread should accept closures.

Test script:

   class T extends Thread
      private $cCallback;
      private $i;

       * @param Closure $cCallback
       * @param int $i unique Thread number
      function __construct(Closure $cCallback, $i)
         $this->cCallback = $cCallback;
         $this->i = $i;

      function run()
         call_user_func_array($this->cCallback, [1]);
   // Callback function:
   $cCallback = function($i) 
      echo $i." finished\n"; 
   $oT = new T($cCallback, 1);

Expected result:
var_dump($this->cCallback); // Closure

Actual result:
var_dump($this->cCallback); // NULL


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-18 18:40 UTC] jrthomas at mtu dot edu
This is happening on PHP v5.6, with pthreads v2.0.8 on Ubuntu 12.04.4 as well.
 [2014-09-18 20:07 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2014-09-18 20:07 UTC]
This is fixed in soon to be released 2.0.9
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Oct 24 14:01:24 2020 UTC