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.
Bookmarks