php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65670 Memcache not storing empty array
Submitted: 2013-09-13 18:39 UTC Modified: 2013-09-16 20:54 UTC
From: swelch at saferack dot com Assigned:
Status: Closed Package: memcache (PECL)
PHP Version: 5.4.19 OS: Linux version 3.2.0-4-686-pae
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: swelch at saferack dot com
New email:
PHP Version: OS:

 

 [2013-09-13 18:39 UTC] swelch at saferack dot com
Description:
------------
gcc 4.6.3
Memcache 2.2.7

Very little changes made to php.ini that shouldn't effect issue.

'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-freetype-
dir=/usr/include/freetype2/freetype' '--with-jpeg-dir=/usr/include' '--with-xsl' 
'--with-zlib' '--enable-sockets' '--with-openssl' '--with-mysql' '--with-mcrypt' 
'--enable-mbstring' '--enable-bcmath' '--enable-calendar' '--with-curl' '--with-
gd' '--with-bz2' '--enable-exif' '--enable-ftp' '--with-gettext' '--with-mhash' 
'--with-mysqli' '--enable-soap' '--enable-wddx' '--enable-zip' '--with-pdo-
mysql' '--with-gmp' '--enable-shmop'

Memcache does not seem to be storing an empty array. I know this may not seem 
needed but I'm storing response from an API that is turned into an array. A 
valid response may be empty which I would like to store.

Test script:
---------------
$mem = new Memcache();
$emptyarr = array();
$mem->add('ABCDEF12345', $emptyarr, true, 1800);

// $mem->get('ABCDEF12345') == false

Expected result:
----------------
Should return an empty array.

$mem->get('ABCDEF12345') == array();

Actual result:
--------------
Getting false.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-14 18:23 UTC] tony2001@php.net
-Status: Open +Status: Feedback
 [2013-09-14 18:23 UTC] tony2001@php.net
What do you get with this code?

$mem = new Memcache();
$emptyarr = array();
$mem->add('ABCDEF12345', $emptyarr, true, 1800);

var_dump($mem->get('ABCDEF12345'));
 [2013-09-16 20:54 UTC] swelch at saferack dot com
-Status: Feedback +Status: Closed
 [2013-09-16 20:54 UTC] swelch at saferack dot com
I know I forgot to put in my connection line but that was actually irrelevant. My 
problem was a logic error. Sorry.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 14:01:31 2025 UTC