|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59533 GearmanJob::unique() returns empty string
Submitted: 2010-12-08 03:49 UTC Modified: 2011-01-27 18:11 UTC
From: nvpetlin at gmail dot com Assigned:
Status: Closed Package: gearman (PECL)
PHP Version: 5.2.11 OS: RHEL 5.4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
26 - 21 = ?
Subscribe to this entry?

 [2010-12-08 03:49 UTC] nvpetlin at gmail dot com
When assigning a unique identifier by running 
doBackground(name,data,id) it cannot be retrieved at the other 
end in the worker function.

Reproduce code:
--- worker.php
  $worker= new GearmanWorker();
  $worker->addFunction("title", "title_function");
  while ($worker->work());

  function title_function($job)
        return ucwords(strtolower($job->workload()));
--- client.php
$client = new GearmanClient();
print $client->doBackground('title', "AlL THE World's a sTagE",'unique');
print "\n";

Expected result:
string "unique"
job handle

Actual result:
string(0) ""
job handle


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-27 17:05 UTC] james dot butler at edigitalresearch dot com
This is not a bug.
You need add the option GEARMAN_WORKER_GRAB_UNIQ to you 
worker options.

  $worker= new GearmanWorker();

GearmanJob::unique will nor return the unique value the 
client assigns it
 [2011-01-27 18:06 UTC] nvpetlin at gmail dot com
Then there is something wrong with the documentation 

"Returns the unique identifiter for this job. The identifier 
is assigned by the client."

Quite the opposite to 
"GearmanJob::unique will nor return the unique value the 
client assigns it"
 [2011-01-27 18:11 UTC] nvpetlin at gmail dot com
I just realized that you meant now instead of not. I 
apologize for my hasty conclusion. The option should perhaps 
be mentioned in the documentation then. As the function seems 
not to be working without it. Well then i rest my case, thank 
you for responding.
 [2011-01-28 12:21 UTC] james dot butler at edigitalresearch dot com
sorry for the mispelling/grammar, was having a fat fingers 
day. Yes this does need fixing in the documentation. I'll 
raise a bug for it.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 23:01:28 2024 UTC