php.net |  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
Votes:8
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-01-07 04:56 UTC] peter at desk dot nl
Description:
------------
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:
---------------
<?php

class SerTest implements Serializable {

  private static $foo = 'bar';

  public function __construct() {}

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

  public function unserialize($data) {}

}

session_start();
$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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-07 05:45 UTC] gopalv@php.net
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: Thu Mar 28 21:01:27 2024 UTC