Skip to content

Possible Bug With Binary / Double Values #202

Closed
@ddrager

Description

@ddrager

Having an occasional bug pop up, still trying to find the root cause but I believe it may be within php-memcached or even the Zend framework.

I am using igbinary serializer to compress/serialize data, which is then stored in the external memcache server. I've verified the data is indeed stored in binary on the memcache server.

Occasionally after a value is stored I begin to get the following error out of our memcached extension:

PHP Warning:  Memcached::get(): could not read double value, too big

This is from php_memcached.c#L3472

The value is not stored in memcache as a double. I believe it is interpreting the binary value as a double, and since it is larger than a double it is triggering this error.

I'm not very good at C but I think it ultimately comes from the Zend function for checking type zend_operators.h.

As stated in the comment for that function, it will result in a double:

...
// or IS_DOUBLE if the number was out of long range or contained a decimal point/exponent.
...

My best guess at this point is that sometimes the binary data matches:

(*ptr == '.' && ZEND_IS_DIGIT(ptr[1]))

So assuming this is the issue, I'm not sure if the best way to handle this is within this repo or within PHP itself. I can't imagine that interpreting a binary value as a double would be good for anyone.

Does anyone have pointer towards how I can troubleshoot this? I have the variables stored in memcache (in binary), but I can't get them out since memcached->get fails out with the double value error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions