• Resolved Daphne C.

    (@dchristof)


    Just to let you know and to help others:

    I installed the plugin and i got an error “The plugin does not have a valid header”. It was installed but not activated. When I tried to activate it I got a fatal error “Parse error: syntax error, unexpected ‘[‘ in file /woocommerce-pay-for-payment/woocommerce-payforpayment.php in line 117”. I checked the code giving the error and it’s this one:

    $chosen_methods=[];

    Note that my PHP version was 5.3.29

    After some investigation I found out that as of PHP 5.4.0 a shortened syntax for declaring arrays has been introduced, so whoever has PHP under 5.4 will get a fatal error. Maybe you can change the code to not use the shortened syntax so that users with previous versions of PHP will not have a problem.

    https://www.ads-software.com/plugins/woocommerce-pay-for-payment/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Same issue here with latest ‘WooCommerce Pay for Payment’ version 1.3.5:
    Parse error: syntax error, unexpected '[' in /home/xxx/webxxx/html/wp-content/plugins/woocommerce-pay-for-payment/woocommerce-payforpayment.php on line 117.
    WordPress latest version: 4.3.

    Replace line 117 with

    $chosen_methods[]=null;

    Thread Starter Daphne C.

    (@dchristof)

    I solved my problem by changing my PHP version to 5.4 in my host’s control panel but not everyone will have this option. Also not everyone is familiar in making code changes and some people are reluctant to edit plugin files since they will lose the changes in the next update but mpbm23 solution is fine for people who need to have the plugin working and don’t mind messing with the code.

    @ mpbm23 – Thanks, but this can not be the only solution. Do you update your plugin?

    This is not my plugin. I am just helping with support and troubleshooting.
    Make the change and I will contact the author to push the update.

    Plugin Author Karolina Vyskocilova

    (@vyskoczilova)

    Closing the thread since it was fixed in the previous update.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Fatal error when trying to activate plugin’ is closed to new replies.