Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2016
    Location
    UK
    Posts
    8
    Plugin Contributions
    0

    Default Official Sagepay Integration - PHP Warning: Illegal string offset 'id'

    ZC version 1.54 PHP Version 5.6.31 Official Sagepay Integration - Version: 1.0

    Logging the following PHP warning

    [12-Aug-2017 06:37:20 Europe/London] PHP Warning: Illegal string offset 'id' in /var/www/vhosts/laptopstands.co.uk/heightadjustabledesks.solutions/includes/modules/payment/sagepay_zc/sagepay_zc_payment.php on line 85

    Line 85 starts $sql =

    Googling the warning infers it is something introduced in PHP 5.4 and to do with strings that should be arrays, don't really know myself, is there a solution to this please.

    PHP Code:
        public function update_status()
        {
            global 
    $order$db;
            if (
    $this->enabled == false || (int)$this->getModuleDefineValue('_ZONE') == 0) {
                return;
            }
            
    $check_flag false;
            
    $sql "SELECT zone_id FROM " TABLE_ZONES_TO_GEO_ZONES " WHERE geo_zone_id = '" . (int)$this->getModuleDefineValue('_ZONE') . "' AND zone_country_id = '" . (int)$order->billing['country']['id'] . "' ORDER BY zone_id";
            
    $checks $db->Execute($sql);
            foreach (
    $checks as $check) {
                if (
    $check['zone_id'] < 1) {
                    
    $check_flag true;
                    break;
                } elseif (
    $check['zone_id'] == $order->billing['zone_id']) {
                    
    $check_flag true;
                    break;
                }
            }
            if (
    $check_flag == false) {
                
    $this->enabled false;
            }
        } 

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Official Sagepay Integration - PHP Warning: Illegal string offset 'id'

    Given the code you posted, an error like that should only occur if there's no "order", or the order has no "country" assigned to the "billing address".
    But if you're in the middle of checkout, that shouldn't ever be the case.

    When exactly is the error happening?
    What plugins do you have installed to your site? (especially any that alter the default checkout flow)
    .

    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.

  3. #3
    Join Date
    Feb 2016
    Location
    UK
    Posts
    8
    Plugin Contributions
    0

    Default Re: Official Sagepay Integration - PHP Warning: Illegal string offset 'id'

    Orders are fully processed without a problem, only have one zone, United Kingdom on freeshiper. Going through the process there is no warning until the order is viewed from the admin panel.

    Freeshiper goes to an orange status if the United Kingdom is set up as the zone so its left as no zone. That may be the issue, I will have to have a look.

  4. #4
    Join Date
    Feb 2016
    Location
    UK
    Posts
    8
    Plugin Contributions
    0

    Default Re: Official Sagepay Integration - PHP Warning: Illegal string offset 'id'

    I think that the reason for this warning is that in the table zones to geo zones the zone id is null.

    Can someone tell me please how this field should get populated with a zone id and if the field is not populated with a zone id would it be the reason for the warning.

  5. #5
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Official Sagepay Integration - PHP Warning: Illegal string offset 'id'

    Quote Originally Posted by mikemc24 View Post
    I think that the reason for this warning is that in the table zones to geo zones the zone id is null.

    Can someone tell me please how this field should get populated with a zone id and if the field is not populated with a zone id would it be the reason for the warning.
    No. As I look at it, there might be a bug in the module.

    In your SagePay module settings, what's your Payment Zone set to? Have you left it at --none-- so that it applies to everyone? Or have you set it to something else, in order to restrict its use to people in certain countries only? I suspect you've changed it from "--none--" to something else. Does changing it to --none-- solve the problem?
    .

    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.

  6. #6
    Join Date
    Feb 2016
    Location
    UK
    Posts
    8
    Plugin Contributions
    0

    Default Re: Official Sagepay Integration - PHP Warning: Illegal string offset 'id'

    Yes, changing the payment zone from United Kingdom to none resolves the issue of the PHP warning and as we only ship to UK there is no impact, thank you.

  7. #7
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Official Sagepay Integration - PHP Warning: Illegal string offset 'id'

    Quote Originally Posted by mikemc24 View Post
    Yes, changing the payment zone from United Kingdom to none resolves the issue of the PHP warning and as we only ship to UK there is no impact, thank you.
    Thanks for reporting back.

    We'll look into addressing what appears to be a bug that triggers the error you mentioned, only under the specific circumstance.
    .

    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.

 

 

Similar Threads

  1. Replies: 9
    Last Post: 23 Mar 2015, 08:42 AM
  2. Replies: 4
    Last Post: 12 Nov 2014, 08:42 PM
  3. v151 PHP Warning: Illegal string offset 'r_error' in linkpoint_api.php
    By BGundlach in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 15 Sep 2014, 09:16 PM
  4. v151 PHP Warning: Illegal string offset 'id'
    By Nettric in forum Bug Reports
    Replies: 3
    Last Post: 30 May 2014, 06:53 AM
  5. Replies: 1
    Last Post: 30 Sep 2013, 07:39 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