Originally Posted by
mc12345678
The if test appears unnecessary when looking at the provided code:
Code:
function admin_notification($zf_order_id) {
global $db;
$output = '';
$aimdata->fields = array();
require(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/authorizenet/authorizenet_admin_notification.php');
return $output;
}
Because there is nothing between the function declaration and the first use of $aimdata-> $aimdata will never be set and therefore the code within the if statement will always be executed. I.e. there is no parameter passed to the function assigned to $aimdata, there's no global $aimdata, and no previous assignment.
Now if that code section is otherwise modified to attempt to pass/operate differently, then it would be helpful to know how it has been edited.
The solution referenced earlier in the conversation was to do something similar but as described without the if statement.
Actually, the following statement is the something that's between the function definition and the first usage.
Code:
$aimdata->fields = array();
Since it's $aimdata->fields that's being assigned that empty array, that's where the issue arises because $aimdata is not an object. I do agree that the change could be simplified as follows to "prepare" for the use of that required handling:
Code:
function admin_notification($zf_order_id) {
global $db;
$output = '';
$aimdata = new stdClass();
$aimdata->fields = array();
require(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/authorizenet/authorizenet_admin_notification.php');
return $output;
}
Bookmarks