Reading class variable value always returns NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

So I have this strange situation where I assign a classvariable a
value, but when I read the value it is NULL.

The class has one variable declared:
=========
class A {
        private $_cookies;
}
=========

In a method of this class I assign this classvariable plus an
undeclared classvariable and a local variable the value 1:
=========
$this->_cookies = 1;
$this->_cookies2 = 1;
$cookies3 = 1;
=========

When I now read the values of those variables, the classvariables are
NULL while the local variable is 1:
=========
$logEntry .= 'cookies: ' . var_export($this->_cookies, true) . PHP_EOL;
$logEntry .= 'cookies2: ' . var_export($this->_cookies2, true) . PHP_EOL;
$logEntry .= 'cookies3: ' . var_export($cookies3, true) . PHP_EOL;
=========
cookies: NULL
cookies2: NULL
cookies3: 1
=========

But when reading the whole object, the classvariables are 1:
=========
$logEntry .= var_export($this, true) . PHP_EOL;
=========
A::__set_state(array(
   '_cookies' => 1,
   '_cookies2' => 1,
))
=========


This happens periodically on a busy webserver. It seems that when it
happens, all classvariables cannot be read anymore (return NULL).
After restarting Apache it does not happen anymore, just to happen
again after some minutes.

The system is current Debian Squeeze:
Linux: linux-image-2.6.32-5-amd64
Apache: apache2-mpm-prefork 2.2.16-6+squeeze7
PHP: PHP 5.3.3-7+squeeze13 with Suhosin-Patch (cli) (built: Jun 10
2012 07:31:32)
php -m: https://raw.github.com/gist/3331641/2f7e80bd03abfb728b659634d3f4bac0131f4d6a/gistfile1.txt
php -i: https://raw.github.com/gist/3331651/bcf6e3654bf391482627505447848de173d0bbab/gistfile1.txt

Does anyone have an idea what could cause this, or how to further debug?

Thanks,
 Reto

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux