Re: Randomly unable to read set variable from class

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

 



Sorry wasn't able to reproduce it on my test machine. 

Do you have any external modules loaded such as APC, memcached, xDebug maybe or other that can affect the output on that machine?

Greetings

On 13 Mar 2012, at 17:02, Adrian Basalic wrote:

> 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:
> 
> .         PHP Version 5.3.3
> 
> .         Linux 2.6.32-220.2.1.el6.x86_64 #1 SMP Fri Dec 23 02:21:33 CST
> 2011 x86_64
> 
> .         Apache 2.0
> 
> 
> 
> class  FooBar
> 
>    {
> 
>      protected $_foo;
> 
>      public function setFoo($bar)
> 
>      {
> 
>        if (!$bar) {
> 
>          print_r("Cannot find bar");
> 
>        }
> 
>        $this->_foo = $bar;
> 
>        if (!$this->_foo) {
> 
>          print_r("Cannot read {$this->_foo} set with $bar");
> 
>          var_dump($this);
> 
>        }
> 
>        var_dump($this);
> 
>        return $this;
> 
>      }
> 
>    }
> 
> 
> 
>    $foobar = new FooBar;
> 
>    $foobar->setFoo('bar');
> 
> 
> 
> The output when this happens would be:
> 
> 
> 
> Cannot read set with barobject(FooBar)#1 (1) { ["_foo":protected]=>
> string(3) "bar" } object(FooBar)#1 (1) { ["_foo":protected]=> string(3)
> "bar" }
> 
> 
> 
> I'm going nuts here, and nobody seems to be able to reproduce this. Where
> should I start looking?
> 


_______________________
Mi blog
CHW
Mi Twitter


-- 
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