|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59227 Connect function does not return correct
Submitted: 2010-05-22 16:28 UTC Modified: 2010-06-01 11:06 UTC
From: info at theindustry dot se Assigned:
Status: Not a bug Package: memcache (PECL)
PHP Version: 5.3.0 OS: XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: info at theindustry dot se
New email:
PHP Version: OS:


 [2010-05-22 16:28 UTC] info at theindustry dot se
Hi everyone,

If I try to connect to a memcached server that doesnt exist or is running, the connect is always True, but if I enter a host name that is obviously wrong, the return is False.
This appears very strange to me. Shouldn't the memcache return FALSE when a connection couldnt be made, as according to the PHP documentation?

Reproduce code:

    $testInstance = new Memcache;
    $var = @$testInstance->connect('localhost', 11211);
    echo $var;
    // Outputs true no matter if the memcached is running or not.


    $testInstance = new Memcache;
    $var = @$testInstance->connect('blablabla', 11211);
    echo $var;
    // Outputs false

Actual result:
Result of connections to non-existent servers returns true.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-01 11:06 UTC]
I cannot recreate this.  My memcached server runs on port 11212.

$testInstance = new Memcache;
$var = @$testInstance->connect('localhost', 11212);

$testInstance = new Memcache;
$var = @$testInstance->connect('localhost', 11211);

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 29 00:01:28 2024 UTC