I have an issue that occurs randomly on a machine. After a number of reloads of the page i can't read $this->_foo although it is set (var_dump shows it but the script cannot read it). The code works locally and on other machines i tested. Apache restart seems to fix it but only temporary.
Environment:
class FooBar { protected $_foo; public function setFoo($bar) { if (!$bar) { print_r("Cannot find bar"); } $this->_foo = $bar; if (!$this->_foo) { print_r("Cannot set {$this->_foo} with $bar"); var_dump($this); } var_dump($this); return $this; } } $foobar = new FooBar; $foobar->setFoo('bar');
The output when this happens would be:
Cannot set with barobject(FooBar)#1 (1) { ["_foo":protected]=> string(3) "bar" } object(FooBar)#1 (1) { ["_foo":protected]=> string(3) "bar" }
:|
ideas?