|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-07-04 19:12 UTC] pecl at seven dot net dot nz
Description:
------------
PHP version is 5.1.4, not 5.1.0.
Apache 2.2.2, Windows XP.
APC version 3.0.10.
Same result on Windows Server 2003.
When storing an array of objects, on retrieval the array indices are kept, but the objects are NULL.
Curiously, It *does* work in one of several much more complex cases I'm using, but not this most basic one.
Reproduce code:
---------------
<?php
$key = 'test';
$original = array (new stdClass ());
apc_store ($key, $original, 3600);
$cached = apc_fetch ($key);
print "<pre>\n";
var_dump ($original);
var_dump ($cached);
?>
Expected result:
----------------
array(1) {
[0]=>
object(stdClass)#1 (0) {
}
}
array(1) {
[0]=>
object(stdClass)#1 (0) {
}
}
Actual result:
--------------
array(1) {
[0]=>
object(stdClass)#1 (0) {
}
}
array(1) {
[0]=>
NULL
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 08:00:02 2025 UTC |
Hi, i'm using caching with APC and Object Arrays but i have the same problem: when i fetch an array of nulls is returned! I'm using PHP 5.1.4 on Apache 2.2 on Windows XP PRO SP2 and APC 3.0.15-dev (Revision: 3.150, Aug 30 2007 07:08:38) Output, using var_dump, is: array(2) { ["it_IT"]=> NULL ["DEFAULT"]=> NULL }Fails also in 3.0.18 and 3.0.19. A generic workaround is to store a serialized version of the variable: list($key, $var) = array('key', unserialize('a:1:{i:0;O:8:"stdClass":1:{s:5:"index";i:0;}}')); // works apc_store($key, serialize($var)); $var2 = unserialize(apc_fetch($key)); assert($var == $var2); // fails apc_store($key, $var); $var2 = apc_fetch($key); assert($var == $var2);