php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #61344 Failure Callback Parameters
Submitted: 2012-03-10 16:25 UTC Modified: 2014-02-01 10:11 UTC
From: adam at adamhahn dot com Assigned: krakjoe (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.10 OS: CentOS 5.7
Private report: No CVE-ID: None
 [2012-03-10 16:25 UTC] adam at adamhahn dot com
Description:
------------
---
From manual page: http://www.php.net/memcache.addserver#refsect1-memcache.addserver-parameters
---

The failure callback function for memcache::addServer is passed more than just the two parameters listed within the documentation.

In addition to passing the hostname and port, three additional callback parameters are passed.

There is a user submitted note regarding this (jwatte at imvu dot com 08-Sep-2011 06:02) however it seems that the note has the last two parameters switched.


Test script:
---------------
$memcache = new Memcache();

$callback = function() {
    print_r(func_get_args());
    die();
};

// localhost memcache is offline/stopped
$memcache->addServer('localhost', 11211, false, 5, 1, 15, true, $callback);

$memcache->set('foo', 'bar');

Expected result:
----------------
According to the existing documentation

Array
(
    [0] => localhost
    [1] => 11211
)

Actual result:
--------------
Array
(
    [0] => localhost
    [1] => 11211
    [2] => 0
    [3] => Connection refused
    [4] => 111
)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-01 10:11 UTC] krakjoe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2014-02-01 10:11 UTC] krakjoe@php.net
The API is now documented differently, this would seem to resolve the issue, I'm not sure when this happened.

Thanks for taking the time to make PHP better :)
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 10:00:01 2026 UTC