Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default Payflow module for v139 won't run under php 7

    The current downloadable Payflow module was written for 1.3.9. It's worked fine in more recent releases though. I installed this on 1.5.5 running with php 7 and it receives the following error
    Code:
    PHP Parse error:  syntax error, unexpected '[', expecting ',' or ';' in /home/eclyonsc/public_html/includes/modules/payment/payflow.php on line 1195
    . I changed the php level on the hosting account to 5.6 and it no longer gets an error. Any chance there's an updated version?

  2. #2
    Join Date
    Jul 2012
    Posts
    16,103
    Plugin Contributions
    17

    Default Re: Payflow module won't run under php 7

    Quote Originally Posted by badarac View Post
    The current downloadable Payflow module was written for 1.3.9. It's worked fine in more recent releases though. I installed this on 1.5.5 running with php 7 and it receives the following error
    Code:
    PHP Parse error:  syntax error, unexpected '[', expecting ',' or ';' in /home/eclyonsc/public_html/includes/modules/payment/payflow.php on line 1195
    . I changed the php level on the hosting account to 5.6 and it no longer gets an error. Any chance there's an updated version?
    More than likely the code contains a function as the same name as the class just above it. Typical action to bring the code to PHP 7.0 level of operation is to change the function's name to __construct. That has been something compatible with PHP 5 for some time now...

    There could be other code that casts the result of a variable to become a variable ie: $$var where $var ="me" would previously create a variable $me. In PHP 7.0 this should become ${$var} to generate $me...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default Re: Payflow module won't run under php 7

    Quote Originally Posted by mc12345678 View Post
    More than likely the code contains a function as the same name as the class just above it. Typical action to bring the code to PHP 7.0 level of operation is to change the function's name to __construct. That has been something compatible with PHP 5 for some time now...

    There could be other code that casts the result of a variable to become a variable ie: $$var where $var ="me" would previously create a variable $me. In PHP 7.0 this should become ${$var} to generate $me...
    Thanks, I'll have a look at that and see if it's an easy fix.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,350
    Blog Entries
    7
    Plugin Contributions
    271

    Default Re: Payflow module won't run under php 7

    Does this match your line 1195? If so, I'm struggling to see any PHP7 issue with that. Hmmm...
    Code:
              if ($order_totals[$i]['code'] == 'ot_total')    $optionsST['AMT']         = round($order_totals[$i]['value'],2);
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default Re: Payflow module won't run under php 7

    Quote Originally Posted by DrByte View Post
    Does this match your line 1195? If so, I'm struggling to see any PHP7 issue with that. Hmmm...
    Code:
              if ($order_totals[$i]['code'] == 'ot_total')    $optionsST['AMT']         = round($order_totals[$i]['value'],2);
    The mod downloaded from https://www.zen-cart.com/downloads.php?do=file&id=212 contains the following around 1195
    Code:
              // handle other order totals:
              global $$order_totals[$i]['code'];
              if ((substr($order_totals[$i]['text'], 0, 1) == '-') || (isset($$order_totals[$i]['code']->credit_class) && $$order_totals[$i]['code']->credit_class == true)) {
                // handle credits
                $creditsApplied += round($order_totals[$i]['value'], 2);
              } else {
                // treat all other OT's as if they're related to handling fees or other extra charges to be added/included
                $surcharges += $order_totals[$i]['value'];
              }
    I've made the following changes and it seems to have solved the problem
    Code:
              // handle other order totals:
              global ${$order_totals[$i]['code']};
              if ((substr($order_totals[$i]['text'], 0, 1) == '-') || (isset($$order_totals[$i]['code']->credit_class) && ${$order_totals[$i]['code']->credit_class} == true)) {
                // handle credits
                $creditsApplied += round($order_totals[$i]['value'], 2);
              } else {
                // treat all other OT's as if they're related to handling fees or other extra charges to be added/included
                $surcharges += $order_totals[$i]['value'];
              }

  6. #6
    Join Date
    Jan 2004
    Posts
    66,350
    Blog Entries
    7
    Plugin Contributions
    271

    Default Re: Payflow module won't run under php 7

    There are a couple places to change on that line.
    Here's what v155 does in the main paypal module:
    Code:
              if ((substr($order_totals[$i]['text'], 0, 1) == '-') || (isset(${$order_totals[$i]['code']}->credit_class) && ${$order_totals[$i]['code']}->credit_class == true)) {
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default Re: Payflow module won't run under php 7

    Quote Originally Posted by DrByte View Post
    There are a couple places to change on that line.
    Here's what v155 does in the main paypal module:
    Code:
              if ((substr($order_totals[$i]['text'], 0, 1) == '-') || (isset(${$order_totals[$i]['code']}->credit_class) && ${$order_totals[$i]['code']}->credit_class == true)) {
    OOPS! Missed one. Thanks Dr B

  8. #8
    Join Date
    Jul 2012
    Posts
    16,103
    Plugin Contributions
    17

    Default Re: Payflow module won't run under php 7

    Quote Originally Posted by badarac View Post
    OOPS! Missed one. Thanks Dr B

    So submitting your 2nd plugin to ZC? :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default Re: Payflow module won't run under php 7

    Quote Originally Posted by mc12345678 View Post
    So submitting your 2nd plugin to ZC? :)
    Oh a wise guy huh?

    You mean Dr B hasn't already done that? I suppose I could pack it up and send it in.

  10. #10
    Join Date
    Jul 2012
    Posts
    16,103
    Plugin Contributions
    17

    Default Re: Payflow module won't run under php 7

    Quote Originally Posted by badarac View Post
    Oh a wise guy huh?

    You mean Dr B hasn't already done that? I suppose I could pack it up and send it in.
    Who me?!

    He does a lot, but can't do everything.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v138a zc_install on server won't run
    By Nyssa in forum Upgrading to 1.5.x
    Replies: 1
    Last Post: 1 Jul 2013, 02:36 AM
  2. Localhost/store won't run anymore
    By ceesdk in forum Installing on a Linux/Unix Server
    Replies: 3
    Last Post: 27 Dec 2011, 08:57 PM
  3. zc_install won't run
    By toriapilar in forum Upgrading from 1.3.x to 1.3.9
    Replies: 11
    Last Post: 19 Oct 2008, 05:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR