2

I am receiving a PHP error on my site since the PHP version updated. The message I am getting is:

Only variables should be assigned by reference.

The code in question this is referring to is

        $this->_base_classes =& is_loaded();

What do I need to change to correct the error? Thanks.

LF00
  • 27,015
  • 29
  • 156
  • 295
user3612498
  • 147
  • 1
  • 4
  • 14
  • `=&` is specifically for assigning variables by reference. Your error is stating that `$this->_base_classes` is not a variable. You'll need to state what `$this` actually is to allow us to provide any more information. – Obsidian Age May 24 '17 at 03:49
  • You can refer to this [post](https://stackoverflow.com/q/11777908/6521116) – LF00 May 24 '17 at 03:53

2 Answers2

0

You are trying use reference on function. Remove the & will be ok. Here is the manual. You can also refer to the comment of this answer.

References in PHP are a means to access the same variable content by different names. They are not like C pointers; for instance, you cannot perform pointer arithmetic using them, they are not actual memory addresses, and so on. See What References Are Not for more information. Instead, they are symbol table aliases. Note that in PHP, variable name and variable content are different, so the same content can have different names. The closest analogy is with Unix filenames and files - variable names are directory entries, while variable content is the file itself. References can be likened to hardlinking in Unix filesystem.

LF00
  • 27,015
  • 29
  • 156
  • 295
-2

Maybe you should also check your PHP version. I encountered the same issue but downgraded PHP to a lower version.

Robert Columbia
  • 6,313
  • 15
  • 32
  • 40
stephen
  • 1
  • 1