php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #64190 Missing ']' under Examples section in memcache.setOptions
Submitted: 2013-02-11 16:37 UTC Modified: 2013-03-02 14:30 UTC
From: grim dot crunch at gmail dot com Assigned: salathe (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: N/A
Private report: No CVE-ID: None
 [2013-02-11 16:37 UTC] grim dot crunch at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/memcached.setoptions
---

<?php
$m = new Memcached();
var_dump($m->getOption(Memcached::OPT_HASH) == Memcached::HASH_DEFAULT);

$m->setOptions([Memcached::OPT_HASH => Memcached::HASH_MURMUR, Memcached::OPT_PREFIX_KEY => "widgets");

var_dump($m->getOption(Memcached::OPT_HASH) == Memcached::HASH_DEFAULT);
echo "Prefix key is now: ", $m->getOption(Memcached::OPT_PREFIX_KEY), "\n";
?>

Test script:
---------------
Should read:

<?php
$m = new Memcached();
var_dump($m->getOption(Memcached::OPT_HASH) == Memcached::HASH_DEFAULT);

$m->setOptions([Memcached::OPT_HASH => Memcached::HASH_MURMUR, Memcached::OPT_PREFIX_KEY => "widgets"]);

var_dump($m->getOption(Memcached::OPT_HASH) == Memcached::HASH_DEFAULT);
echo "Prefix key is now: ", $m->getOption(Memcached::OPT_PREFIX_KEY), "\n";
?>


Expected result:
----------------
As seen and expected from the documentation:

$ php /path/to/example.php
bool(true)
bool(false)
Prefix key is now: widgets

$

Actual result:
--------------
$ php /path/to/example.php
PHP Parse error:  syntax error, unexpected ')', expecting ']' in /path/to/example.php on line 5

Parse error: syntax error, unexpected ')', expecting ']' in /path/to/example.php on line 5

$

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-03-02 14:28 UTC] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=329615
Log: fix example syntax error (doc #64190)
 [2013-03-02 14:30 UTC] salathe@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2013-03-02 14:30 UTC] salathe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: salathe
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 04:00:01 2026 UTC