|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59564 APC 'forgets' static properties
Submitted: 2011-01-07 04:56 UTC Modified: 2011-01-07 05:45 UTC
Avg. Score:4.1 ± 1.3
Reproduced:6 of 7 (85.7%)
Same Version:2 (33.3%)
Same OS:1 (16.7%)
From: peter at desk dot nl Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: 5.3.2 OS: Linux Ubuntu 10.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
22 - 3 = ?
Subscribe to this entry?

 [2011-01-07 04:56 UTC] peter at desk dot nl
I have some classes that use static properties. When using the Serializable interface and accessing these properties during (un)serialization, the static properties of the class are undefined. Problem disappears when apc is turned off.

Reproduce code:

class SerTest implements Serializable {

  private static $foo = 'bar';

  public function __construct() {}

  public function serialize() {
    return serialize(self::$foo);

  public function unserialize($data) {}


$test = new SerTest();
$_SESSION['test'] = $test;


Expected result:
expect blank output.

Actual result:
after the second load :

Fatal error: Access to undeclared static property: SerTest::$foo in /var/www/serialize.php on line 10


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-07 05:45 UTC]
APC does cleanup of class specific data during its exit.

You can either juggle your extension loading order to load session before apc, so that the session handlers are called without failures.

Or, just do an auto_append_file which contains a session_write_close(); explicitly.
 [2012-01-04 15:20 UTC] astewart at online-buddies dot com
This happens to us, too. Workaround of reordering extensions doesn't work when 
the session module is compiled in and APC is not.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 23:01:30 2024 UTC