Quote Originally Posted by DrByte View Post
NOTE: This is ONLY reporting a warning, which only occurs because of PHP 7.2's new strict mode.

The irony is that it's triggered when checking if any errors exist, and since nothing has been recorded as errors, but the variable where errors are stored hasn't been declared, this warning is triggered.

You can fix this minor issue by adding a new line as shown here, around line 325 in /includes/modules/payment/square.php:
Code:
        $body         = new \SquareConnect\Model\ZenCartChargeRequest($request_body);
        $errors_object = array();

        try {
            $result        = $api_instance->charge($location->id, $body);
            $errors_object = $result->getErrors();
DrByte; however, when looking at current ZC 1.5.6 code, both the try and catch parts contain an assignment of $errors_object so that it is defined in both cases. Looking at the response results code, it appears that if there is no error, then $errors_object will have a value of null. The value null is not countable leading to the warning(s) reported. This review was performed on the v156 branch of github instead of v1.5.6c, but regardless would apply.

I did not though exhautively search to validate that all error results would be an array which is why I suggested to edadk that a check of is_array may also be necessary. The thought though is that all error responses are either null or an array containing the associated error response data and therefore such a check should not be necessary for properly written code.