Forums / Built-in Shipping and Payment Modules / PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

Views: 2,242

Results 1 to 20 of 23
8 Sep 2017, 11:04 AM
#1
spbw avatar

spbw

New Zenner

Join Date:
Jan 2012
Posts:
50
Plugin Contributions:
0

PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

spbwshop.co.uk
V1.5.5e

I upgraded from 1.5.1 recently and, after some trials & tribulations, now have the shop fully working. We did get sales through PayPal but when I went on to the Admin to check our API details today I found that the modules no longer show. As per attached. Yet it appears to be still working.

Are they hidden? Or somewhere else?

Thanks

8 Sep 2017, 11:06 AM
#2
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

You have a partial white page. Please check your logs folder for any debug files, and paste the content here. (minus sensitive data like admin folder name).

8 Sep 2017, 11:18 AM
#3
spbw avatar

spbw

New Zenner

Join Date:
Jan 2012
Posts:
50
Plugin Contributions:
0

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

Thanks,
If this is the Cpanel error log then it is only showing a 404 with the sitemap.

8 Sep 2017, 11:44 AM
#5
spbw avatar

spbw

New Zenner

Join Date:
Jan 2012
Posts:
50
Plugin Contributions:
0

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

It is a huge file - attached

8 Sep 2017, 12:09 PM
#7
spbw avatar

spbw

New Zenner

Join Date:
Jan 2012
Posts:
50
Plugin Contributions:
0

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

Sorry, did not go deep enough.

[08-Sep-2017 06:50:15 America/Chicago] PHP Parse error: syntax error, unexpected '[' in /home/*****/public_html/includes/modules/payment/payeezyjszc.php on line 158

function selection()
{
global $order;

    // Payeezy currently only accepts  "American Express", "Visa", "Mastercard", "Discover", "JCB", "Diners Club"
    $cc_types = [];
    if (CC_ENABLED_VISA == 1) {
        $cc_types[] = ['id' => 'Visa', 'text' => 'Visa'];
    }
    if (CC_ENABLED_MC == 1) {
        $cc_types[] = ['id' => 'Mastercard', 'text' => 'Mastercard'];
    }
    if (CC_ENABLED_DISCOVER == 1) {
        $cc_types[] = ['id' => 'Discover', 'text' => 'Discover'];
    }
    if (CC_ENABLED_AMEX == 1) {
        $cc_types[] = ['id' => 'American Express', 'text' => 'American Express'];
    }
    if (CC_ENABLED_JCB == 1) {
        $cc_types[] = ['id' => 'JCB', 'text' => 'JCB'];
    }
    if (CC_ENABLED_DINERS_CLUB == 1) {
        $cc_types[] = ['id' => 'Diners Club', 'text' => 'Diners Club'];
    }

    // Prepare selection of expiry dates
8 Sep 2017, 12:21 PM
#9
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,118
Plugin Contributions:
56

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

spbw:

Sorry, did not go deep enough.
The log that you're receiving

[08-Sep-2017 06:50:15 America/Chicago] PHP Parse error:  syntax error,  unexpected '[' in  /home/*****/public_html/includes/modules/payment/payeezyjszc.php on line  158

implies that your store is running on an older (PHP 5.3?) version of PHP, prior to the implementation of updated PHP array references that the payeezyjszc payment method uses.

As a quick fix, you can simply rename the file /includes/modules/payment/payeezyjsrc.php to payeezyjsrc.php.notused while you sort out your hosted PHP version, bringing it up to at least PHP 5.6 (preferably 7.0 or 7.1).

8 Sep 2017, 12:34 PM
#10
spbw avatar

spbw

New Zenner

Join Date:
Jan 2012
Posts:
50
Plugin Contributions:
0

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

Checked the Cpanel and it tells me, under server info, that it is PHP5.6.1

8 Sep 2017, 12:35 PM
#11
spbw avatar

spbw

New Zenner

Join Date:
Jan 2012
Posts:
50
Plugin Contributions:
0

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

Sorry

5.6.31

8 Sep 2017, 12:44 PM
#12
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

Obviously cpanel is wrong, or you would not get this error. Check in your Zen Cart admin with pressing the version button to see what your actual php version is .

8 Sep 2017, 12:52 PM
#13
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,118
Plugin Contributions:
56

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

Use your admin's Tools->Server/Version Info. What PHP version does that show?

8 Sep 2017, 1:04 PM
#14
spbw avatar

spbw

New Zenner

Join Date:
Jan 2012
Posts:
50
Plugin Contributions:
0

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

Correct!

Shop shows 5.3.29 - that is annoying to have the Cpanel show something else.

8 Sep 2017, 1:24 PM
#15
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

spbw:

Correct!

Shop shows 5.3.29 - that is annoying to have the Cpanel show something else.
Yes it is. Now try switching between php version in cpanel, and see is the problem resolves, because if the php version is 5.5 or above you should be fine

8 Sep 2017, 1:35 PM
#16
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

Design75:

Yes it is. Now try switching between php version in cpanel, and see is the problem resolves, because if the php version is 5.5 or above you should be fine
While should be using 5.6 or above, it was actually in 5.4 that the square bracket (short array) syntax was introduced per the php online docs: http://php.net/manual/en/language.types.array.php

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

8 Sep 2017, 1:42 PM
#17
spbw avatar

spbw

New Zenner

Join Date:
Jan 2012
Posts:
50
Plugin Contributions:
0

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

The system default PHP version is set by the system administrator.
Any domain that is set to the inherit value indicates that it does not have its own PHP version explicitly set. Read more about inherit.

ea-php56

Looks like I will have to get the server guys to check this out for me.

I have to go out for a few hours but will return later tonight.

many thanks for the help.

I appreciate.

8 Sep 2017, 2:08 PM
#18
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,118
Plugin Contributions:
56

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

spbw:

Correct!

Shop shows 5.3.29 - that is annoying to have the Cpanel show something else.
Check the root directory for your shop, making sure that you don't have a php.ini file there that is specifying that down-level version of PHP.

Another place to check (but the cPanel "should" decode those) is the site's root-directory .htaccess file to make sure that there aren't directives that are forcing that PHP version.

Update (since I recently ran into this on a client's site): Within your admin's Tools->Server/Version Info, check the value for Loaded Configuration File (towards the top of the list). That's normally not within your site-specific directories; if found, try renaming to php.ini~ and re-run that tool to see if anything changes.

8 Sep 2017, 2:19 PM
#19
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

mc12345678:

While should be using 5.6 or above, it was actually in 5.4 that the square bracket (short array) syntax was introduced per the php online docs: http://php.net/manual/en/language.types.array.php
:blink: in 5.4 already. Who would have thought that. :laugh:

8 Sep 2017, 10:04 PM
#20
spbw avatar

spbw

New Zenner

Join Date:
Jan 2012
Posts:
50
Plugin Contributions:
0

Re: PHP Parse error: syntax error, unexpected '[' in payeezyjs.php

lat9:

Check the root directory for your shop, making sure that you don't have a php.ini file there that is specifying that down-level version of PHP.

Another place to check (but the cPanel "should" decode those) is the site's root-directory .htaccess file to make sure that there aren't directives that are forcing that PHP version.

Update (since I recently ran into this on a client's site): Within your admin's Tools->Server/Version Info, check the value for Loaded Configuration File (towards the top of the list). That's normally not within your site-specific directories; if found, try renaming to php.ini~ and re-run that tool to see if anything changes.

Thanks.

No php.ini spotted
.htaccess does not show PHP version.

Server/Version

Virtual Directory Support disabled
Configuration File (php.ini) Path /opt/alt/php53/etc
Loaded Configuration File /opt/alt/php53/etc/php.ini
Scan this dir for additional .ini files /opt/alt/php53/link/conf
Additional .ini files parsed /opt/alt/php53/link/conf/alt_php.ini

I cannot see the /opt/ files, but it is likely to be hidden from me.

I am not long in, off to bed now and an early start tomorrow. If I get time I will do a write-up and send it to the server people for help. If they get it sorted then I will note the resolution here for others.

thanks again for the assistance.