Tuesday, June 7, 2016

Joomla Admin Page Broken After php 7.0.7

I recently upgraded my php version to 7.0.7. Although not a php bug, some strict warnings were reclassified (correctly so) in php 7 leading my Joomla Administrator page to go non compos mentis. The following is the page I got after logging in as Administrator:


Fix:

1. Go to line 57 of the file "Site folder"/htdocs/administrator/modules/mod_menu/menu.php
2. Remove the ampersand "&"

Before: public function addChild(JMenuNode &$node, $setCurrent = false)
After: public function addChild(JMenuNode $node, $setCurrent = false)

This change will help to get the Admin panel working, but a good coder will also update the parameter description in the comments section for this function.

Reference:

The purpose of this post is to help beginners who encounter a vrot Administrator Panel right after successfully installing Joomla using php 7.0.7. Anyone above beginners level can read through the reported issue and understand the reason for this behaviour:
https://issues.joomla.org/tracker/joomla-cms/10452
or alternatively: https://github.com/joomla/joomla-cms/pull/10452

Fix in non-newbie language:
https://github.com/joomla/joomla-cms/commit/c2c80d3ffdd877bfac27fdf72776a9f64661fef9
https://github.com/joomla/joomla-cms/commit/f2fb7c4a30faade62bdcb733872f0f07d2b5f647

Error created in the following environment:
Joomla 3.5.1
Apache 2.4.20
MySQL 5.7.12
php 7.0.7