470,596 Members | 1,177 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,596 developers. It's quick & easy.

Is a static class member not restored after session reload?

I'd like to use 3 types of objects, which have a kind of
availability-check as a static object in their parent class.

After page reload the initialised member is NULL
Is this a PHP 5.2.5 feature or am I missing something?

First page in a session:

class Checker {

function check () {
echo 'OK';

class Common {

protected static $checker;

class Special extends Common {

static function setChecker( ) {
parent::$checker = new Checker();

function show() {
echo parent::$checker->check(); <-- error !

Special::setChecker ( );

$_SESSION['b'] = new Special();

second page in same session:
(after start of session with class definitions)

Fatal error: Call to a member function check() on a non-object

on the indicated line
Jan 19 '08 #1
0 1130

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by fred | last post: by
1 post views Thread by Chris Bardon | last post: by
10 posts views Thread by Flare | last post: by
4 posts views Thread by Mantorok | last post: by
2 posts views Thread by james | last post: by
1 post views Thread by cobus.lombard | last post: by
7 posts views Thread by Spoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.