致命错误:升级到Joomla 3.5.1后,无法使用stdClass类型的对象作为数组
Fatal error: Cannot use object of type stdClass as array in dministrator/components/com_menus/models/item.php on line 548
Lines #546-#550:
// Get selected fields
$filters = JFactory::getApplication()->getUserState('com_menus.items.filter');
$data['published'] = (isset($filters['published']) ? $filters['published'] : null);
$data['language'] = (isset($filters['language']) ? $filters['language'] : null);
$data['access'] = (isset($filters['access']) ? $filters['access'] : null);
Error occurred while creating a new menu item in Menu Manager.
The Menu Manager works fine until upgrading from Joomla 3.4.1 to 3.5.1.
Ensure your extensions are running the latest versions.
You can also search for uses of
JFilterInput::clean(SOMETEXT);
and replace it with:
$filter = new JFilterInput;
$filter->clean(SOMETEXT);
Check this : https://docs.joomla.org/J3.x:Fatal_Error_in_Input_Filtering/en
As $filters
is an object with properties, not an array with elements; so you need to use object syntax to access those properties:
$data['published'] = (isset($filters->published) ? $filters->published : null);
$data['language'] = (isset($filters->language) ? $filters->language : null);
$data['access'] = (isset($filters->access) ? $filters->access : null);
Thanks a lot for the pointers, Mark and Rishi.
I solved the problem by downloading the full Joomla 3.5.1 package and replace the entire administrator/components/com_menus directory, and it works now!
I suspect there are some files missing during the 3.4.1->3.5.1 update process (using the Joomla Update Manager). I would recommend doing manual upgrade to avoid unexpected or unwanted situations.