|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58193 addServer always returns true
Submitted: 2008-05-12 00:09 UTC Modified: 2008-05-12 03:29 UTC
From: orgchart at yahoo dot com Assigned:
Status: Not a bug Package: memcache (PECL)
PHP Version: 5.1.6 OS: CentOS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
11 + 23 = ?
Subscribe to this entry?

 [2008-05-12 00:09 UTC] orgchart at yahoo dot com
addServer() always returns true, regardless if a connection was made or not.

Reproduce code:

system('memcached -d -p 11211 -u nobody -c 64 -m 64 -P /var/run/memcached/11211');
system('memcached -d -p 11212 -u nobody -c 64 -m 64 -P /var/run/memcached/11211');
$memcache = new Memcache;
$res = $memcache->addServer('localhost', 11211);
var_dump ($res);
$res = $memcache->addServer('localhost', 11212);
var_dump ($res);
$res = $memcache->addServer('localhost', 11213);
var_dump ($res);


Expected result:
object(Memcache)#1 (1) {
  resource(7) of type (memcache connection)

Actual result:
object(Memcache)#1 (1) {
  resource(7) of type (memcache connection)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-12 03:29 UTC] mikael at synd dot info
Thank you for taking the time to write to us, but this is not
a bug.

As indicated in the API docs ( the connection isn't established until actually needed. 

If you really want all connections to be established and tested (note that there's some overhead in this, thus the lazy connect policy of addServer) you should use the connect/pconnect methods instead.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 00:01:32 2024 UTC