0

I make the integration of Wincache with Joomla 1.5, but i see often, in php_errors this:

PHP Warning: Creating default object from empty value in joomla.php on line 136

The code is this:

$session =& JFactory::getSession();
$session->set('user', $instance);

$storage = $session->_store;
$session_data = $storage->readSessionData($session->getId());
/*136*/ $session_data->guest    = $instance->get('guest');
$session_data->username = $instance->get('username');

I think that I need to declare the object but i don't know how...

Thanks!

3 Answers3

0

these are warnings.

If they do not affect your site usability, you may turn them of using the backend.

Go to Global Configuration.

In the server tab (If I remember well) there is something like Error Reporting.

Turn it off by setting it to none.

pcrikos
  • 87
  • 5
0

Joomla 1.5 is past end of life and does not really work perfectly in current version of PHP (since it was written to support 4.4.7 an... so a lot of things that didn't used to generate warnings are going to generate warnings if you have modern PHP and it sometimes can really not be worth the effort. Does $instance actually exist?

Elin
  • 6,507
  • 3
  • 25
  • 47
  • Yes, i altro try this very similar solution but nothing... http://stackoverflow.com/questions/8900701/creating-default-object-from-empty-value-in-php – dean_78 Aug 16 '14 at 09:50
0

Problem solved! $session_data was empty in some circoustance so this generate the problem:

$session_data = $storage->readSessionData($session->getId());

For solve it, simple add:

if (! $storage->readSessionData($session->getId()) ){$session_data = new stdClass();}

Thanks to all!