|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2013-01-18 19:01 UTC] krakjoe@php.net
  [2013-01-18 19:40 UTC] krakjoe@php.net
  [2013-01-18 19:40 UTC] krakjoe@php.net
 
-Status:      Open
+Status:      Closed
-Assigned To:
+Assigned To: krakjoe
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 20:00:01 2025 UTC | 
Description: ------------ Hello, 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 0.0.0.0:80 -t D:/localhost/htdocs -e -a) Debugging: php5ts.dll!5fa2eb3389 Test script: --------------- <?php require_once("./function.php"); require_once("./libs/Smarty.class.php"); // http://www.smarty.net/ $data = "test"; $func = 1; $smarty = new Smarty(); $smarty->assign('test', $data); print_r(MyThreadFunc($func, $smarty)); ?> <?php error_reporting(E_ALL); 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); } unset($this->data); } } function MyThreadFunc($func, $data) { $t = microtime(true); $g = new MyThread($func, $data); /* starting synchronized */ if($g->start()) { printf("Request took %f seconds to start ", microtime(true)-$t); //while($g->isRunning()) //{ // echo "."; // usleep(100); //} if ($g->join()) { printf(" and %f seconds to finish\n", microtime(true)-$t); return $g->res; } else { printf(" and %f seconds to failed\n", microtime(true)-$t); } } unset($data); } 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