Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005
    Location
    Syracuse, New York, USA
    Posts
    37
    Plugin Contributions
    1

    Default [Done v1.3.9a] linkpoint "trim" error under 5.3.1 in _sendRequest

    At line 746 of linkpoint, under 1.3.8a with the PHP 5.3 mods applied, and running under 5.3.1, I get a warning on:

    Code:
        $failure = (trim($result) == '<r_approved>FAILURE</r_approved><r_error>Could not connect.</r_error>' || !is_array($result) || $result["r_approved"] != "APPROVED") ? true : false;
    of "Warning: trim() expects parameter 1 to be string, array given in /home/jbi/public_html/nso/modules-payment-linkpoint_api.php on line 746".

    Of course, this error only happens when $result is an array (sometimes it's a string, in which case no PHP error would arise).

    But I'm also puzzled by this line of code.

    Surely if $result is ANY string, $failure will be true, because "!is_array($result)" will be true.

    If I'm reading this right, then "trim($result) == '<r_approved>FAILURE</r_approved><r_error>Could not connect.</r_error>'" is irrelevant.

    In other words, these two booleans surely evaluate the same:

    Code:
    trim($result) == '<r_approved>FAILURE</r_approved><r_error>Could not connect.</r_error>' || !is_array($result) || $result["r_approved"] != "APPROVED"
    and

    Code:
    !is_array($result) || $result["r_approved"] != "APPROVED"
    Anybody have any better insights about this?

    I'm thinking that if $result is a string, then it's an error message, while if it's an array, then the result of $result['r_approved'] needs to be tested. But before going in that direction, I'd appreciate other, more knowing, eyes on this.

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

    Default Re: linkpoint "trim" error under 5.3.1 in _sendRequest

    Yes, that code change would be suitable.
    .

    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 2005
    Location
    Syracuse, New York, USA
    Posts
    37
    Plugin Contributions
    1

    Default Re: [Done v1.3.9] linkpoint "trim" error under 5.3.1 in _sendRequest

    There is a second place in the code where the same logic appears (around line 409):

    Code:
    if (trim($result) == '<r_approved>FAILURE</r_approved><r_error>Could not connect.</r_error>' || !is_array($result))
    which is logically the same as (well, minus the PHP warning!):

    Code:
    if (!is_array($result))

 

 

Similar Threads

  1. v151 Changing the "Down For Maintenance" to "Under Construction"
    By SilverHD in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 18 Feb 2014, 04:51 AM
  2. v150 "Admin Settings" and "Email Welcome" not showing up under Tools Menu
    By chad2012 in forum Installing on a Mac Server
    Replies: 2
    Last Post: 28 Jan 2012, 07:56 PM
  3. how to change the "privacy notice" under "information"?
    By Judy404 in forum Basic Configuration
    Replies: 1
    Last Post: 17 Sep 2009, 07:40 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