php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65836 Incompative/invalid arguments
Submitted: 2013-10-05 08:12 UTC Modified: 2013-10-12 17:43 UTC
From: pajoye@php.net Assigned: pajoye (profile)
Status: Closed Package: memcache (PECL)
PHP Version: 5.5.4 OS: *
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: pajoye@php.net
New email:
PHP Version: OS:

 

 [2013-10-05 08:12 UTC] pajoye@php.net
Description:
------------
Using the following simple test, the following errors occur:

<30 new binary client connection.
<30 Read binary protocol data:
<30    0x80 0x02 0x00 0x04
<30    0x10 0x00 0x00 0x00
<30    0x00 0x00 0x00 0x17
<30    0x00 0x00 0x00 0x00
<30    0x00 0x00 0x00 0x00
<30    0x00 0x00 0x00 0x00
>30 Writing an error: Invalid arguments
>30 Writing bin response:
>30   0x81 0x02 0x00 0x00
>30   0x00 0x00 0x00 0x04
>30   0x00 0x00 0x00 0x11
>30   0x00 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x00
Protocol error (opcode 02), close connection 30
<30 connection closed.


Alternatively other errors can happen. It looks like the 3.x branche is somehow broken (tested only with the binary protocol), or am I missing something?

Test script:
---------------
ini_set("memcache.protocol", "binary");
$memcache = new Memcache;
$memcache->connect('192.168.221.128', '11211') or die ("Could not connect");
var_dump($memcache->add('test', '123'));
var_dump($memcache->get('test', '123'));


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-10-08 19:16 UTC] pajoye@php.net
-Assigned To: +Assigned To: pajoye
 [2013-10-08 19:16 UTC] pajoye@php.net
The problem is the calculation of the extra length in the store
function. header.cas is not part of extra, I have checked the specs
again and no operation consider cas as part of extras.
Changing the pack header call from:

mmc_pack_header(&(header->base), op, 0, key_len, sizeof(*header) -
sizeof(header->base), request->sendbuf.value.len - valuelen);

to:

mmc_pack_header(&(header->base), op, 0, key_len,
sizeof(mmc_store_request_header_t) - sizeof(mmc_request_header_t) -
sizeof(header->cas), request->sendbuf.value.len - valuelen);


seems to fix the problem. I also changed the sizeof call for clarity
(we know which type we are using here, instead of using the local
variable ptr).

Does it make sense or am I missing something? Also I wonder why we did
not have a bug report about that, or maybe this exact memcached server
version is more sensible than other, thoughts?
 [2013-10-12 17:43 UTC] pajoye@php.net
-Status: Assigned +Status: Closed
 [2013-10-12 17:43 UTC] pajoye@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 03:01:33 2025 UTC