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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 09:01:32 2024 UTC