|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-10-05 15:56 UTC] gabrielnn77 at gmail dot com
Description:
------------
APC 3.1.13
the script fail to find class constant in the sleep method (fail in the second excecution )
error:
PHP Fatal error: Undefined class constant 'A_CONSTANT' in /home/var/www/html/tmp/apc_test.php on line 23
Test script:
---------------
session_start();
class A{
public $b;
public function __sleep(){
$this->b->f();
return array('b');
}
}
class B{
const A_CONSTANT = 1;
public $var;
public function f(){
$this->var = self::A_CONSTANT;
}
}
if(isset($_SESSION['lalala'])){
echo "<pre>";
$a = $_SESSION['lalala'];
print_r($a);
}
// 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 21:00:02 2025 UTC |
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