php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #63042 Only one option can be added
Submitted: 2012-09-08 02:10 UTC Modified: 2017-01-10 08:22 UTC
From: goran dot v dot miskovic at gmail dot com Assigned:
Status: Suspended Package: gearman (PECL)
PHP Version: Irrelevant OS: Ubuntu 12.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: goran dot v dot miskovic at gmail dot com
New email:
PHP Version: OS:

 

 [2012-09-08 02:10 UTC] goran dot v dot miskovic at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/gearmanclient.setoptions#refsect1-
gearmanclient.setoptions-description
---
$ php -i | grep Version
PHP Version => 5.3.10-1ubuntu3.2
$ php -i | grep gearman
Additional .ini files parsed => /etc/php5/cli/conf.d/gearman.ini,
gearman
gearman support => enabled
libgearman version => 0.27
$ pecl info gearman
About pecl.php.net/gearman-1.0.2

Documentation reads that multiple options can be set at once while only a single 
option can be set at once.

Function name is also misleading and it should be GearmanClient::setOption() but 
that is another topic. :)

Test script:
---------------
<?php
$client = new GearmanClient();
$result = $client->addOptions(GEARMAN_CLIENT_NON_BLOCKING, GEARMAN_CLIENT_FREE_TASKS, GEARMAN_CLIENT_UNBUFFERED_RESULT);
var_dump($result);

Expected result:
----------------
bool(true)

Actual result:
--------------
PHP Fatal error:  Uncaught exception 'ErrorException' with message 
'GearmanClient::addOptions() expects exactly 1 parameter, 3 given'

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-08 03:21 UTC] reeze dot xia at gmail dot com
From #63043

Hi goran,

http://php.net/manual/zh/gearmanworker.removeoptions.php

THere is one param, these option should be combined if you want multiple
$client = new GearmanClient();
$client->addOptions(GEARMAN_CLIENT_NON_BLOCKING);
$client->addOptions(GEARMAN_CLIENT_FREE_TASKS);
$client->addOptions(GEARMAN_CLIENT_UNBUFFERED_RESULT);
$result = $client->removeOptions(GEARMAN_CLIENT_NON_BLOCKING | 
GEARMAN_CLIENT_FREE_TASKS | GEARMAN_CLIENT_UNBUFFERED_RESULT);

You could do the same thing with addOptions() :)
 [2012-09-08 08:53 UTC] goran dot v dot miskovic at gmail dot org
Hi Reeze! Thanks!
However, then, the next section "Parameters" could be enhanced.
Instead of reading "The options to be removed (unset)" it will be more 
informative to say: Pipe separated list of the options to be removed (unset).
I will be free to post example in user comments.
 [2012-09-08 08:59 UTC] goran dot v dot miskovic at gmail dot com
Uff... Sorry. I mixed the tickets but I hope you got the point. :)
It will be more informative to say in the "Parameters" section: Pipe separated 
list of the options to add.
 [2012-09-08 08:59 UTC] goran dot v dot miskovic at gmail dot com
-: goran dot v dot miskovic at gmail dot org +: goran dot v dot miskovic at gmail dot com
 [2012-09-08 16:01 UTC] laruence@php.net
this is similar issue with #63041.
closed that one, leave this
 [2012-09-24 01:18 UTC] hradtke@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: hradtke
 [2017-01-10 08:22 UTC] kalle@php.net
-Status: Assigned +Status: Suspended -Assigned To: hradtke +Assigned To:
 [2017-01-10 08:22 UTC] kalle@php.net
The gearman extension have not had much activity in the past few years, so I'm taking the safe bet that this is no longer under active development (as I don't consider the typo fixes on the github repo an active development), besides that it also targets unsupported PHP versions. Please unsuspend this report in case it begins to blossom with life once more
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC