php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58214 Store of array may fail
Submitted: 2008-06-03 12:06 UTC Modified: 2008-07-15 06:59 UTC
From: gdiego at gmail dot com Assigned:
Status: Closed Package: APC (PECL)
PHP Version: 5.2.5 OS: Debian
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: gdiego at gmail dot com
New email:
PHP Version: OS:

 

 [2008-06-03 12:06 UTC] gdiego at gmail dot com
Description:
------------
If you store an array with an object inside the object is not stored

Reproduce code:
---------------
class whatever {
};

$a = new whatever();
$z = array(1, $a);
apc_store("hello", $a);
apc_store("hello2", $z);

var_dump(apc_fetch("hello")); //brings the correct object
var_dump(apc_fetch("hello2")); //brings the array 0=>1, 1=>NULL


Expected result:
----------------
bring array 0=>1, 1=>object

Actual result:
--------------
bring array 0=>1, 1=>NULL

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-03 15:09 UTC] gdiego at gmail dot com
I think the error comes from apc_cache_store_zval function in apc_cache.c...

if((src->type & ~IS_CONSTANT_INDEX) == IS_OBJECT) {
... it serializes it
} else {
... it doesn't

if src->type is an array it might have an object inside and it might be copying a reference, returning NULL later?
 [2008-07-15 06:59 UTC] gopalv82 at yahoo dot com
Been a long time in fixing, ut it's fixed 

http://news.php.net/php.pecl.cvs/11029

check CVS HEAD, please
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 05:01:33 2025 UTC