|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-03-23 16:59 UTC] andrei@php.net
[2012-03-23 16:59 UTC] andrei@php.net
-Summary: failure during get() resets resultCode
+Summary: Add binary session support
-Status: Open
+Status: Closed
-PHP Version: 5.3.10
+PHP Version: Irrelevant
-Assigned To:
+Assigned To: andrei
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 16:00:01 2025 UTC |
Description: ------------ If an error occurs while attempting to perform a Memcached::get(), the result code will be set to RES_NOTFOUND. However, that result is actually masking the more important error (such as connection failure, timed out, server is marked dead, etc...) Replacing the Memcached::get() call with a Memcached::set() call results in the *correct* result code being reported. Test script: --------------- <?php $mc = new Memcached(); $mc->addServer('10.2.3.4', 5555); // Server should not exist $mc->setOption( Memcached::OPT_RETRY_TIMEOUT, 1 ); while (true) { // Note how it changes if you remove either the get() call or the set() call. // Having only get(), results in "NOT FOUND" printed repeatedly. $result = $mc->get('foo'); echo var_export( $result, true ), "; ", $mc->getResultCode( ), ': ', $mc->getResultMessage( ), "\n"; $result = $mc->set('foo', 1, 0); echo var_export( $result, true ), "; ", $mc->getResultCode( ), ': ', $mc->getResultMessage( ), "\n"; usleep(250000); } Expected result: ---------------- false; 3: CONNECTION FAILURE false; 35: SERVER IS MARKED DEAD false; 35: SERVER IS MARKED DEAD false; 35: SERVER IS MARKED DEAD false; 3: CONNECTION FAILURE false; 35: SERVER IS MARKED DEAD false; 35: SERVER IS MARKED DEAD false; 35: SERVER IS MARKED DEAD false; 3: CONNECTION FAILURE ... Actual result: -------------- false; 16: NOT FOUND false; 35: SERVER IS MARKED DEAD false; 16: NOT FOUND false; 35: SERVER IS MARKED DEAD false; 16: NOT FOUND false; 35: SERVER IS MARKED DEAD false; 16: NOT FOUND false; 35: SERVER IS MARKED DEAD ...