Error - Fatal error: Only variables can be passed by reference

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
Ryno

Error - Fatal error: Only variables can be passed by reference

Post by Ryno »

Hi,

Has anyone had any trouble running this on a PHP5 instalation?

When I tried to access the admin area, I got this message "Fatal error: Only variables can be passed by reference in c:\wamp\www\petfriendlyrentals\lib\classes\class.admintheme.inc.php on line 143"

I'm by no means a PHP guru but I heard some of the Object Orientated code syntax has changed from PHP 4 to 5 and I'm wondering if that could be the problem?

My server configuration is below:

Apache version :  Apache/1.3.33 (Win32)
PHP version :  5.1.0RC1
MySQL version :  4.1.13a-nt - extension : mysqli
Akrabat

Re: Error - Fatal error: Only variables can be passed by reference

Post by Akrabat »

That's a "feature" of 5.1 IIRC.  It caused because array_pop takes a reference to an array and passing the results of an explode() directly results in a temporary var to be created that cannot be used as a reference.

Change line 143 of lib/classes/class.admintheme.inc.php
from

Code: Select all

$this->script = array_pop(explode('/',$this->url));
to

Code: Select all

$tmp = explode('/',$this->url);
$this->script = array_pop($tmp);
and let me know if that solves the problem.
Tux!

Re: Error - Fatal error: Only variables can be passed by reference

Post by Tux! »

YES!! that change resolve the problemmm..
thx a lot!!!

Besitos!! xD
Locked

Return to “CMSMS Core”