php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61466 Add binary session support
Submitted: 2012-03-21 20:03 UTC Modified: 2012-03-23 16:59 UTC
From: jhansche at myyearbook dot com Assigned: andrei (profile)
Status: Closed Package: memcached (PECL)
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jhansche at myyearbook dot com
New email:
PHP Version: OS:

 

 [2012-03-21 20:03 UTC] jhansche at myyearbook dot com
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
...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-23 16:59 UTC] andrei@php.net
Please re-open this issue on GitHub:

https://github.com/php-memcached-dev/php-memcached/issues
 [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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC