php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #63043 Only one option can be removed at time
Submitted: 2012-09-08 02:44 UTC Modified: 2012-09-08 15:59 UTC
From: goran dot v dot miskovic at gmail dot com Assigned:
Status: Not a bug 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 this is not your bug, you can add a comment by following this link.
If this is your bug, but 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:44 UTC] goran dot v dot miskovic at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/gearmanclient.removeoptions#refsect1-
gearmanclient.removeoptions-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 one or more options can be removed at time while only 
one option can be removed at time.

Test script:
---------------
<?php
$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);
var_dump($result);

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

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-08 03:19 UTC] reeze dot xia at gmail dot com
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 09:00 UTC] goran dot v dot miskovic at gmail dot com
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 15:59 UTC] laruence@php.net
-Status: Open +Status: Not a bug
 [2012-09-08 15:59 UTC] laruence@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 05:01:30 2024 UTC