|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64013 CLI crashed
Submitted: 2013-01-17 17:46 UTC Modified: 2013-01-18 19:40 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: neu dot markus at web dot de Assigned: krakjoe (profile)
Status: Closed Package: pthreads (PECL)
PHP Version: 5.4.11 OS: Windows 7 64bit
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: neu dot markus at web dot de
New email:
PHP Version: OS:


 [2013-01-17 17:46 UTC] neu dot markus at web dot de

I'm using PHP 5.4.10 ts, 5.4.11 ts and 5.5Alpha1 ts.
I run PHP in CLI mode. (D:\localhost\php\php.exe -S -t 
D:/localhost/htdocs -e -a)

Debugging: php5ts.dll!5fa2eb3389

Test script:
require_once("./libs/Smarty.class.php"); //

$data = "test";

$func = 1;

$smarty = new Smarty();
$smarty->assign('test', 	$data);

print_r(MyThreadFunc($func, $smarty));


class MyThread extends Thread
    public $func;
    public $data;
    public $res;
    public function __construct($func, $data)
        $this->func = $func;
        $this->data = $data;

    public function run()
        //printf("%s is Thread #%lu\n", __CLASS__, $this->getThreadId());
        if($this->func == 1)
            $this->res = func1($this->data);
        elseif($this->func == 2)
            $this->res = func2($this->data);
        elseif($this->func == 3)
            $this->res = func3($this->data);
        elseif($this->func == 4)
            $this->res = func4($this->data);



function MyThreadFunc($func, $data)
    $t = microtime(true);
    $g = new MyThread($func, $data);
    /* starting synchronized */
        printf("Request took %f seconds to start ", microtime(true)-$t);
        //    echo ".";
        //    usleep(100);
        if ($g->join())
            printf(" and %f seconds to finish\n", microtime(true)-$t);
            return $g->res;
            printf(" and %f seconds to failed\n", microtime(true)-$t);

function func1($data)
	return $smarty->fetch('test.tpl');
function func2($data)
	return $data;
function func3($data)
	return $data;
function func4($data)
	return $data;


Expected result:
The template test.tpl should displayed

Actual result:
Allow obj in Threads or build an error report


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-18 19:01 UTC]

Please try this snapshot, test it with php-5.4 only, I've no snapshots available 
for 5.5 yet.

Objects are supported in Threads.

If the errors persist, please provide a script that exhibits the problem that is 
self contained.
 [2013-01-18 19:40 UTC]
I have noticed an error in pthreads, which is fixed in the latest code in git, 
no snapshot yet I'll roll one tomorrow, I cannot release the code in git, I have 
a few minor bugs to squish first.

I have also noticed some errors in your logic, func1 has no $smarty defined. The 
only place you can share variables is the object context. Please see the 
documentation and examples included in the release for correct usage, and the 
PHP manual for an explanation of the environment and it's functionalities.

Thanks for your report.
 [2013-01-18 19:40 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Oct 23 06:01:24 2020 UTC