php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59410 Wrong warning 'The lowest two bytes of the flags' on x86_64
Submitted: 2010-09-10 12:36 UTC Modified: 2013-02-18 00:35 UTC
Votes:20
Avg. Score:4.0 ± 1.2
Reproduced:19 of 20 (95.0%)
Same Version:9 (47.4%)
Same OS:11 (57.9%)
From: konstantin at symbi dot org Assigned:
Status: No Feedback Package: memcache (PECL)
PHP Version: 5_3 SVN-2010-09-10 (dev) OS: Linux 2.6 x86_64
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-09-10 12:36 UTC] konstantin at symbi dot org
Description:
------------
                php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"The lowest two bytes of the flags array is reserved for 
pecl/memcache internal use");

On 64 bit systems, warning is raised when it should not

Reproduce code:
---------------
Reproduce code:

$memcache->set('x', 'v', 64);

Patch:

--- memcache-3.0.4/memcache_pool.c.orig 2010-09-10 20:25:20.108394357 +0400
+++ memcache-3.0.4/memcache_pool.c      2010-09-10 20:26:23.568393739 +0400
@@ -349,7 +349,7 @@
 int mmc_pack_value(mmc_pool_t *pool, mmc_buffer_t *buffer, zval *value, unsigned int *flags TSRMLS_DC) /*
        does serialization and compression to pack a zval into the buffer {{{ */
 {
-       if (*flags & 0xffff & ~MMC_COMPRESSED) {
+       if ((*flags >> 2 << 2) != *flags) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "The lowest two bytes of the flags array is reserved for pecl/memcache internal use");
                return MMC_REQUEST_FAILURE;
        }

Expected result:
----------------
no error

Actual result:
--------------
"The lowest two bytes of the flags array is reserved for 
pecl/memcache internal use" warning

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-05 16:05 UTC] hradtke@php.net
The following works fine for me:
$memcache = new Memcache;
$memcache->addServer('localhost', 11211);

$memcache->set('x', 'v', MEMCACHE_COMPRESSED);
$memcache->set('x', 'v');

What are you trying to do with the "64" value the set() method?  Is that supposed to be the timeout?
 [2010-10-05 16:12 UTC] konstantin at symbi dot org
It is a flags value, its meaning is not significant in 
context 
of the bug.

I should be able to set any flags value (if I do not alter 
the 
bits used internally by pecl/memcache). But it was broken in 
the 3.x branch.
 [2010-11-26 02:07 UTC] hradtke@php.net
The problem is that your patch breaks a lot of code.  That intention of that particular code block is to only allow the flag parameter to be set with a value of 2 (MEMCACHE_COMPRESSED) or 1 (internal serialized value).  If any other bit is set, then it throws that warning.  Allowing any arbitrary value will break existing logic in the code.

I can change the warning to something like: "Invalid flag specified."
 [2011-09-03 22:01 UTC] gikuukan at nirai dot ne dot jp
http://www.allmedications.net/ prednisone buy uvul http://www.medicationsnow.com/ nexium 12681
 [2011-09-12 21:01 UTC] icc at ryukyu dot ne dot jp
http://www.yourpillshouse.com/ on line sale of colchicine 96755 http://www.halfpricemed.com/ genericviagra 626534
 [2013-02-18 00:35 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 08 13:03:41 2021 UTC