Doc #54658 [NEW]: The return type of Memcache:pconnect is NOT boolean!

From: Date: Wed, 04 May 2011 12:17:16 +0000
Subject: Doc #54658 [NEW]: The return type of Memcache:pconnect is NOT boolean!
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-6339@lists.php.net to get a copy of this message
From: Operating system: RH5 PHP version: 5.2.17 Package: Documentation problem Bug Type: Documentation Problem Bug description:The return type of Memcache:pconnect is NOT boolean! 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 bug report at http://bugs.php.net/bug.php?id=54658&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54658&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54658&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54658&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54658&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54658&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54658&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54658&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54658&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54658&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54658&r=support Expected behavior: http://bugs.php.net/fix.php?id=54658&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54658&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54658&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54658&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54658&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54658&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54658&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54658&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54658&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54658&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54658&r=mysqlcfg

« previous php.doc.bugs (#6339) next »