Support Forum

Error 500 after update, can't complete update (catch 22, multisite + solution)

JE Jeferson
Jeferson
Member

 Hello,

 

After updating simple:press our wordpress multisite gave an error 500 and could only be viewed by disabling the simple:press plugin. 

Also the simple:press plugin still needed to be upgraded (to be completed) so it was a bit of a catch 22 issue. Update caused error 500, can’t update further cause of error 500 -> disable plugin = no 500 but can’t update and can’t use it then) 

So after using the debug console a bit I found out that there was only 1 page causing a 500 error for the installation. When looking into the HTTP error logs I found: 

[Tue May 10 09:50:29 2016] [error] [client MyClient] PHP Fatal error:  Can’t use function return value in write context in /var/www/html/BLABLA/wp-content/sp-resources/forum-plugins/mycred/sp-mycred-plugin.php on line 83, referer: http://BLABLA.com/BLABLA/wp-admin/admin.php?page=simple-press%2Fsp-startup%2Fsp-load-install.php

To avoid this error + the catch 22 I commented out the if around line 83 in sp-mycred-plugin.php. 
After that I could run the update, and bring everything back to normal. 

6 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

My apologies for you getting the error… but I am somewhat puzzled as I don’t quite see what is likely to be wrong there!

Line 83 itself – 

if (defined('myCRED_VERSION') && !empty(get_option('mycred_setup_completed'))) {

has not changed. So if it causes an error condition it should always have done so. Line 84 changed to include the call to the WP function admin_url() but that should be fine as, if the function determines the site is an MS install it copes with this.

I will do some digging…

YS Yellow Swordfish
Yellow Swordfish
Member

Hang on a minute…

Can you tell me what your PHP version is please?

JE Jeferson
Jeferson
Member

PHP version: 

PHP 5.3.3 (cli) (built: Jan 5 2016 08:55:01)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies 

YS Yellow Swordfish
Yellow Swordfish
Member

Thanks. That explains it – although doesn’t explain why you have not had the error before as that code has been in place a long time.

It is the use of the ’empty’ function. Prior to PHP 5.5 you had to pass an actual variable into the empty function. Post 5.5 it can take a function or expression that evaluates to a value.

I have also misinterpreted the WordPress minimum requirements for PHP. I see that it recommends 5.6 as a minimum version – not actually requires it. For the record the site states:

Note: If you are in a legacy environment where you only have older PHP or MySQL versions, WordPress also works with PHP 5.2.4+ and MySQL 5.0+, but these versions have reached official End Of Life and as such may expose your site to security vulnerabilities

So something, perhaps, for you to consider. But meanwhile I will correct the error and again – apologies for it happening. I would love to know why this has not reared it’s head for you before but I guess that will remain a mystery!

JE Jeferson
Jeferson
Member

Well it is the first time we update simple:press and it only occurs when updating. 
Also using a newer version of PHP is a bit tricky since s390x is always a bit behind unless we compile it ourselves.