Active
Project:
pgapi - Payment Gateway API
Version:
6.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Dec 2011 at 19:19 UTC
Updated:
15 Dec 2011 at 19:23 UTC
Hello. Please remove or replace wrong ctype_digit() check into pgapi_transaction_load(). ctype_digit() expects string as parameter. Otherwise it returns FALSE and object $txnid is not created. But number is passed to that function.
function txnid_load($txnid) {
$txnid = (int) $txnid; // THERE $txnid
return pgapi_transaction_load($txnid); // $txnid - IS A NUMBER, NOT A STRING.
}
function pgapi_transaction_load($txnid) {
if (ctype_digit($txnid)) { // int passed, not a number. The function always returns FALSE
$transaction = db_fetch_object(db_query("SELECT * FROM {pgapi_transaction} WHERE txnid = %d", $txnid));
if ($transaction) {
// Unserialize data
$transaction->extra = unserialize($transaction->extra);
return $transaction;
}
}
return FALSE;
}
Comments
Comment #1
Rostislav Sergeenkov commentedthe simpliest way to fix is to replace
with
Comment #1.0
Rostislav Sergeenkov commentedpgapi_transaction_load() added to show up the bug