php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60500 get with cas token fails to fetch all results
Submitted: 2011-12-12 16:17 UTC Modified: 2012-04-01 22:47 UTC
From: trevor at blubolt dot com Assigned: andrei (profile)
Status: Closed Package: memcached (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: trevor at blubolt dot com
New email:
PHP Version: OS:

 

 [2011-12-12 16:17 UTC] trevor at blubolt dot com
Description:
------------
When performing a get with a cas token requested a multi-get is performed 
internally.  After doing so 
only the first result is fetched, leaving the final RES_END result on the stack.  
As per the 
libmemcached documentation memcached_fetch_result should be called until it 
returns NULL following a 
multi-get.

In some circumstances this is not noticeable as libmemcached takes care of 
flushing the receive buffers 
accordingly, however certain subsequent operations will incorrectly return the 
left-over RES_END result.  
I have seen this behaviour exhibited when performing a get with cas token 
request followed by an add 
operation though there may be other examples.

I have tested this with memcached extension version 2.0.0b2 using libmemcached 
0.53 and 1.0.2, though I 
believe the issue also exists with earlier versions.

Please find attached a patch against 2.0.0b2 to address this issue which both 
resolves the primary issue 
and also simplifies the call in the case that a cas token is not required  by 
calling 
memcached_get_by_key.

Please let me know if I've been unclear!


Patches

fix-get (last revision 2011-12-12 16:18 UTC by trevor at blubolt dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-01 22:47 UTC] andrei@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: andrei
 [2012-04-01 22:47 UTC] andrei@php.net
Re-opened on Github as an issue, so closing here.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 11:01:30 2024 UTC