Plugin could not be activated because it triggered a fatal error

Hi folks,
I installed and used the plugin until some weeks ago when during an update it break my blog :frowning:
Deactivated and de-installed it now I can’t install it anymore

public static function get_options() {
$options = ; <---- line 23

            $discourse_option_groups = get_option( 'discourse_option_groups' );
            if ( $discourse_option_groups ) {

That’s my record on mysql, I just removed it but… nothing :frowning:

| 32290 | discourse | a:19:{s:3:“url”;s:31:“http://community.nethserver.org”;s:7:“api-key”;s:64:“xxxxxx”;s:16:“publish-username”;s:12:“alefattorini”;s:16:“publish-category”;i:1;s:17:“full-post-content”;i:1;s:12:“auto-publish”;i:1;s:10:“auto-track”;i:1;s:18:“allowed_post_types”;a:1:{i:0;s:4:“post”;}s:22:“use-discourse-comments”;i:1;s:25:“existing-comments-heading”;s:0:"";s:12:“max-comments”;s:1:“5”;s:11:“min-replies”;s:1:“1”;s:9:“min-score”;s:1:“0”;s:15:“min-trust-level”;s:1:“1”;s:24:“bypass-trust-level-score”;s:2:“50”;s:21:“custom-excerpt-length”;s:2:“55”;s:22:“custom-datetime-format”;s:0:"";s:10:“login-path”;s:0:"";s:10:“sso-secret”;s:0:"";} | yes |

Any hint?

I think it’s because you have an old version of php.

You can either update php or change that to the old syntax,which is something like

$options = array();
1 Like

Thanks but I have another error at line 165 the last one ;-(

you can’t just delete the one,you have to declare the array. Think that there is another one somewhere too. I did it last week, and don’t remember exactly. I think I got it to work, but can’t quite remember. I will try to check when I get to the office.

1 Like

What PHP version do you have on your server? I can update the plugin to support php 5.3.

Sorry, standard CentOS 6 php-5.3.3

I think the only issue the plugin has with php 5.3 is that it’s creating an array with []. That can be changed. I’ll update it later today or early tomorrow.

2 Likes

Isn’t PHP 5.3 EOL? Might be wiser to have the user upgrade their PHP so they are still getting security patches.

2 Likes

I’m pretty sure that’s right, @simon. I had this problem last week and I think that I just changed two array declarations and that it worked after that. (OTOH, I’ve configured a whole bunch of stuff and it could be that there was something else wrong and I gave up.)

That’s definitely true. In my case, I’m working on moving off of my old Ubuntu 12.04 server. I’m sure it’s going to happen any day now. :slight_smile:

Yes it looks like it is: PHP: Unsupported Branches. I haven’t been testing against it. I can change the array declarations anyway.

I was going to suggest that, but perhaps it’s better that only people who can fix that code such that it works with PHP5.3 be able to use it. :slight_smile:

Or even just put a “VERSION X required” test somewhere.

2 Likes

I think the people who are saying that the plugin shouldn’t support PHP versions < 5.4.0 are right. I’ve just updated the plugin and added a check for the PHP version to the plugin’s activation function. Attempts to activate the plugin with an unsupported PHP version will be halted.

I’ve also added a couple of notes to the plugin’s readme to say that it requires php >=5.4.0.

@alefattorini if you are unable to update your PHP version and need a hand getting the plugin running on php-5.3.3, get in touch with me.

3 Likes

Assuming that the packages being used are those provided by the OS vendor, that version of PHP will get security updates, based on backported patches of security vulnerabilities provided for later releases.

Thanks Simon, I appreciate it. Let me know how can I edit the plugin to adapt to my php version

Try this: https://github.com/scossar/wp-discourse/tree/beta-php-5.3

It passes the php-5.3 codesniffer. You can click on the ‘Clone or download’ button on that page to download a zip file.

3 Likes

This is the best solution. Even if it’s a simple change to allow support for PHP 5.3, it’s a really bad idea to encourage any usage of it whatsoever.

PHP 5.3 has been unsupported for over 2 years. PHP 5.5 is EOL. PHP 5.6 support ends in 1 month.

4 Likes

Sorry for the late response, it works like a charm :slight_smile:
Thanks so much, I owe you one!

Note: this repo was created to help people with existing wp-discourse setups that broke when updating from a previous version of the plugin. It won’t be receiving any updates!

If your WordPress installation is using a php version of less than 5.4, contact your hosting provider to see what can be done about upgrading the version.

4 Likes