Doc #54658 [Opn->Csd]: The return type of Memcache:pconnect is NOT boolean!
| From: | frozenfire@php.net | Date: | Sat, 02 Jul 2011 08:05:31 +0000 |
| Subject: | Doc #54658 [Opn->Csd]: The return type of Memcache:pconnect is NOT boolean! | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-6804@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54658&edit=1
ID: 54658
Updated by: frozenfire@php.net
Reported by: eu at serbannistor dot ro
Summary: The return type of Memcache:pconnect is NOT boolean!
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: RH5
PHP Version: 5.2.17
-Assigned To:
+Assigned To: frozenfire
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2011-07-02 04:05:15] frozenfire@php.net
Automatic comment from SVN on behalf of frozenfire
Revision: http://svn.php.net/viewvc/?view=revision&revision=312801
Log: Fixed Memcache::pconnect return value, closing bug #54658
------------------------------------------------------------------------
[2011-05-04 14:17:15] eu at serbannistor dot ro
Description:
------------
---
From manual page: http://www.php.net/memcache.pconnect#Return
Values
---
In fact, Memcache::pconnect(), just like Memcache::connect() returns a mixed type.
It will return a Memcache object if the connection is successful or a boolean false if the
connection fails. Also a notice and an error will be outputted.
Test script:
---------------
<?php
// memcached is running
$memcache_obj1 = memcache_pconnect("memcache_host1", 11211);
var_dump($memcache_obj1);
/*
will output:
object(Memcache)#3 (1) {
["connection"]=>
resource(6) of type (memcache connection)
}
*/
// memcached is stopped
$memcache_obj2 = memcache_pconnect("memcache_host2", 11211);
var_dump($memcache_obj2);
/*
will output:
PHP Notice: memcache_pconnect(): Server memcache_host2 (tcp 11211) failed with: Connection refused
(111) in /home/jdoe/memcache-test.php on line 31
Notice: memcache_pconnect(): Server memcache_host2 (tcp 11211) failed with: Connection refused (111)
in /home/jdoe/memcache-test.php on line 31
PHP Warning: memcache_pconnect(): Can't connect to memcache_host2:11211, Connection refused
(111) in /home/jdoe/memcache-test.php on line 31
Warning: memcache_pconnect(): Can't connect to memcache_host2:11211, Connection refused (111)
in /home/jdoe/memcache-test.php on line 31
bool(false)
*/
Expected result:
----------------
According to the documentation the output for the above cases should be:
bool(true);
bool(false);
Actual result:
--------------
Stated above in the description.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54658&edit=1