I have created a plugin that is running good in PHP v5.5.x. When I upgrade my PHP version to 7.x it gives me errors.

Code that is suspicious is:

$this->EE =& get_instance();

Error is:

only variables should be passed by reference


As error says, PHP 7 is only allow variables to passed by reference not an instance. You now need to remove that line and replace all $this->EE calls to ee(). That will work for you.

  • This works, I know it will work if I replace instance reference call by ee(). However I was looking for workaround with $this->EE. May 16 '17 at 12:50

Pretty sure you don't need this in a plugin `$this->EE =& get_instance(); ref https://docs.expressionengine.com/v2/development/plugins.html

  • I know it is not needed, but i want to use $this->EE instead of ee() call May 16 '17 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.