Loaded modules: core prefork http_core mod_so mod_auth_basic mod_auth_digest mod_authn_file mod_authn_alias mod_authn_anon mod_authn_dbm mod_authn_default mod_authz_host mod_authz_user mod_authz_owner mod_authz_groupfile mod_authz_dbm mod_authz_default util_ldap mod_authnz_ldap mod_include mod_log_config mod_logio mod_env mod_ext_filter mod_mime_magic mod_expires mod_deflate mod_headers mod_usertrack mod_setenvif mod_mime mod_dav mod_status mod_autoindex mod_info mod_dav_fs mod_vhost_alias mod_negotiation mod_dir mod_actions mod_speling mod_userdir mod_alias mod_substitute mod_rewrite mod_proxy mod_proxy_balancer mod_proxy_ftp mod_proxy_http mod_proxy_ajp mod_proxy_connect mod_cache mod_suexec mod_disk_cache mod_cgi mod_version mod_fcgid mod_perl mod_php5 mod_python mod_ssl -----Original Message----- From: Camilo Sperberg [mailto:unreal4u@xxxxxxxxx] On Behalf Of Camilo Sperberg Sent: Wednesday, March 14, 2012 1:42 AM To: Adrian Basalic Cc: php-general@xxxxxxxxxxxxx Subject: Re: Randomly unable to read set variable from class 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