|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63224 error in __sleep whit reference to other classes
Submitted: 2012-10-05 15:56 UTC Modified: 2013-02-18 00:36 UTC
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:3 (100.0%)
From: gabrielnn77 at gmail dot com Assigned:
Status: No Feedback Package: APC (PECL)
PHP Version: 5.4.7 OS: 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: gabrielnn77 at gmail dot com
New email:
PHP Version: OS:


 [2012-10-05 15:56 UTC] gabrielnn77 at gmail dot com
APC 3.1.13
the script fail to find class constant in the sleep method (fail in the second excecution )
 PHP Fatal error:  Undefined class constant 'A_CONSTANT' in /home/var/www/html/tmp/apc_test.php on line 23

Test script:

class A{
	public $b;
	public function __sleep(){
		return array('b');

class B{
	const A_CONSTANT = 1;
	public $var;

	public function f(){
		$this->var = self::A_CONSTANT;

	echo "<pre>";
	$a = $_SESSION['lalala'];

//	another file
//	class A and B use autoload
$b = new B();
$a = new A();
$a->b = $b;

$_SESSION['lalala'] = $a;

Expected result:
no error

Actual result:
 PHP Fatal error:  Undefined class constant 'A_CONSTANT' in /home/var/www/html/tmp/apc_test.php on line 23


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-05 21:54 UTC]
This is highly likely due to the session handler being called after APC mops up 
the classes.

Can you try adding a session_write_close() at the end of the script?
 [2012-10-10 14:06 UTC] gabrielnn77 at gmail dot com
yes, this works
I have another error, but I do not know whether to the APC module, or if it is related to this solution

PHP Fatal error:  Uncaught exception 'UnexpectedValueException' with message 
'Error at offset 1923 of 38785 bytes' in ....
Stack trace:
#0 [internal function]: ArrayIterator->unserialize('x:i:0;a:10:{i:0...')

the error occurs randomly, and I could not detect that is what produces
 [2012-12-05 14:45 UTC]
Automatic comment from SVN on behalf of ab
Log: added a test for bug #63224
 [2012-12-05 15:00 UTC]
I can't repro the latter error using apc trunk and php 5.4.9, most likely it's not APC related. Could you test again? Also i've added your test code to tests/bug63224.phpt, would be useful if you'd run it in your environment.
 [2012-12-05 15:00 UTC]
-Status: Open +Status: Feedback
 [2013-02-18 00:36 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Oct 04 17:03:58 2022 UTC