Doc #63042 [Opn]: Only one option can be added
| From: | goran dot v dot miskovic at gmail dot org | Date: | Sat, 08 Sep 2012 08:53:03 +0000 |
| Subject: | Doc #63042 [Opn]: Only one option can be added | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-8827@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63042&edit=1
ID: 63042
User updated by: goran dot v dot miskovic at gmail dot org
Reported by: goran dot v dot miskovic at gmail dot org
Summary: Only one option can be added
Status: Open
Type: Documentation Problem
Package: gearman
Operating System: Ubuntu 12.04
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2012-09-08 03:21:51] 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 02:10:26] goran dot v dot miskovic at gmail dot org
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'
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63042&edit=1