PHP fatal error after upgrade to Pro version

Riba
Topic Author
Posts: 3
6 years 1 week ago #2977 by Riba
Hello there,

I have just upgraded to Pro version and it is giving me a fatal PHP error when activated. Previously I have successfully used a free 7.x version. The error I am getting is following:

PHP Fatal error: Can't use method return value in write context in /home/riba/public_html/joomla/modules/mod_shoutbox/helper.php on line 1661

I suspect it may be PHP version related as I am using oldish PHP version until the site gets updated, although everything else seems to work fine. Any help is appreciated.

Thanks!

Please Log in or Create an account to join the conversation.

Riba
Topic Author
Posts: 3
6 years 1 week ago #2978 by Riba
It seems that I resolved it by defining the variables before doing the checks in the function, like this:
private function getIpAddress()
	{
		$server = JFactory::getApplication()->input->server;
		$server_ip = $server->get('HTTP_CLIENT_IP');
		$server_fwd = $server->get('HTTP_X_FORWARDED_FOR');
		if (!empty($server_ip))
		{
			$ip = $server->get('HTTP_CLIENT_IP');
		}
		elseif (!empty($server_fwd))
		{
			$ip = $server->get('HTTP_X_FORWARDED_FOR');
		}
		else
		{
			$ip = $server->get('REMOTE_ADDR');
		}
		
		// If we don't have a valid IP address just store null in the database
		if (filter_var($ip, FILTER_VALIDATE_IP) === false)
		{
			return null;
		}
		else
		{
			return filter_var($ip, FILTER_VALIDATE_IP);
		}
	}

Please Log in or Create an account to join the conversation.

Lodder
Lodder's Avatar
Posts: 1185
6 years 1 week ago #2979 by Lodder
Hi Riba.

Just about to head off to bed now but will definitely look into this first thing tomorrow morning.

Could you let me know which PHP version you're using?

Or better yet, could you possibly provide me with a temporary super admin account so I can look further into the issue and apply any necessary fixes? If so, please send a link to your site and the login details to This email address is being protected from spambots. You need JavaScript enabled to view it.

Regards,
Lodder

Please Log in or Create an account to join the conversation.

Lodder
Lodder's Avatar
Posts: 1185
6 years 1 week ago #2980 by Lodder
Oops, just saw your reply as I replied. Could you state your PHP version so I know which versions this affects? If it fall within our minimum bracket, I'll add the fix you mentioned for the next update.

Please Log in or Create an account to join the conversation.

Riba
Topic Author
Posts: 3
6 years 1 week ago #2981 by Riba
Hey Lodder! Just checked, the PHP version is 5.4.45-0+deb7u3. It is old, but Joomla 3.5 works fine on it so maybe it makes sense to make Shoutbox play friendly. I did the change after doing a quick search and stumbled on this bit of info:

www.davidtan.org/php-solution-for-cant-u...ue-in-write-context/

It seems it has done the trick.

Please Log in or Create an account to join the conversation.

Lodder
Lodder's Avatar
Posts: 1185
6 years 1 week ago #2982 by Lodder
Hi Riba,

PHP 5.4 is perfectly fine. We support PHP 5.3.10 which is the minumum version that Joomla supports, so I'll definitely be applying the fix you provided.

Thank you.

If you have any more issues or questions, please feel free to ask.

Regards,
Lodder

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum