|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58989 apc_store loses data on storing object
Submitted: 2009-12-14 05:39 UTC Modified: 2009-12-15 14:47 UTC
From: ben at downstairs dot com Assigned:
Status: Not a bug Package: APC (PECL)
PHP Version: 5.3.0 OS: suse linux
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:
Bug Type:
From: ben at downstairs dot com
New email:
PHP Version: OS:


 [2009-12-14 05:39 UTC] ben at downstairs dot com
When storing data that came from a SimpleXMLObject to an apc cache with apc_store the data will be lost upon retrieval.

Seems related to bug #8118.

Reproduce code:
$data = ""XML File from Youtube API"";
$xml = simplexml_load_string($data);
foreach ($xml->entry as $entry)
$media = $entry->children('');
$title = $media->group->title;
$videos[] = array("title" => $title);

storing and refetching $videos will yield an empty array (keys intact, data lost).

typecasting $title to string works around this.

so "$title = (string) $media->group->title;" in above example fixes it.

Expected result:
Expected array I stored to cache.

Actual result:
Got array with keys intact but no data.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-14 11:54 UTC]
You can't cache internal magic objects.  Only user-space 
 [2009-12-15 04:28 UTC] ben at downstairs dot com
Might I suggest having APC throw a warning-message when it's about to store data it doesn't like in some way?

I for one was completely unaware there's stuff like "magic objects" out of "user space" ;)
 [2009-12-15 14:47 UTC]
Adding a warning for IS_RESOURCE seems like a good idea to me, any objects for reasons I'm not aware of?
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Nov 30 11:01:27 2023 UTC