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

Rostislav Sergeenkov’s picture

the simpliest way to fix is to replace

if (ctype_digit($txnid)) {

with

if (is_numeric($txnid)) {
Rostislav Sergeenkov’s picture

Issue summary: View changes

pgapi_transaction_load() added to show up the bug