PHP Notice: Only variables should be assigned by reference

1.2k Views Asked by At

I am getting the following error.

PHP Notice: Only variables should be assigned by reference in /var/www/html/plugins/system/jxtcadminlock/jxtcadminlock.php

I am usig PHP 7.2

And the 39th line of the file(/var/www/html/plugins/system/jxtcadminlock/jxtcadminlock.php) is as below.

$mainframe =& JFactory::getApplication('admin');

I need to fix this without upgrading joomla.

1

There are 1 best solutions below

0
Álvaro González On

First of all, this is just a notice. If you aren't going to fix your codebase manually to make it PHP/7 compliant you can just ignore it.

If I'm not wrong that's the old PHP/4 syntax, obsoleted in 2004, to deal with the fact that objects used to be passed by value rather than reference. It's quickly mentioned in the Migrating from PHP 4 to PHP 5.0.x guide.

Since PHP/5 you can drop the & sign altogether. However, it's very likely that this isn't the only compatibility issue.