|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-04-02 15:31 UTC] tpunt@php.net
-Status: Open
+Status: Not a bug
[2017-04-02 15:31 UTC] tpunt@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 23:00:01 2025 UTC |
Description: ------------ I'm using the last version of the package: 2.0.10 The "collect" method returns elements in wrong order, always overwrites the first result with the last result. Test script: --------------- class job extends Collectable { public $val; public function __construct($val){ $this->val = $val; } public function run(){ 'started ' .$this->val . PHP_EOL; sleep(1); 'finished ' .$this->val . PHP_EOL; $this->setGarbage(); } } $p = new Pool(1); $tasks = array( new job('job1'), new job('job2'), new job('job3'), new job('job4'), new job('job5') ); foreach ($tasks as $task) $p->submit($task); $p->shutdown(); $p->collect(function($checkingTask){ $checkingTask->val; }); Expected result: ---------------- job1 job2 job3 job4 job5 Actual result: -------------- job5 job2 job3 job4 job5