2

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

2 Answers 2

3

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.

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

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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