Hello everybody...

I'm creating a free file download site (only registered users can purchase and download files) and need help. I download a purchased file, the counter for Downloads goes from 0 -> 1 and the Addresses stays at 0 (it should go to 1 right?). When I want to refresh or go to another page this what happens:

Notice: Undefined property: stdClass::$addresses in _uc_file_log_download() (line 423 of C:\xampp\htdocs\drupal\sites\all\modules\ubercart\uc_file\uc_file.pages.inc).
Warning: in_array() expects parameter 2 to be array, null given in _uc_file_log_download() (line 424 of C:\xampp\htdocs\drupal\sites\all\modules\ubercart\uc_file\uc_file.pages.inc).
Notice: Undefined property: stdClass::$accessed in _uc_file_log_download() (line 430 of C:\xampp\htdocs\drupal\sites\all\modules\ubercart\uc_file\uc_file.pages.inc).
Notice: Undefined property: stdClass::$fuid in drupal_write_record() (line 7188 of C:\xampp\htdocs\drupal\includes\common.inc).
(As you can see I'm using xampp and windows for local server)

And the counter for Downloads goes back to 0. At my database, in table uc_file_users there are "addresses" always a:0:{} and "accessed" 0. What is wrong with this?

Comments

deathL’s picture

Assigned: deathL » Unassigned
deathL’s picture

Title: File Download Address and Downloads issue » Notice: Undefined property: stdClass::$addresses in _uc_file_log_download()
Issue summary: View changes
TR’s picture

Sounds like your uc_files table is corrupted. The addresses property is defined and populated by the db_query of the uc_files table. If you have an addresses column in the table, you shouldn't get this notice. Assuming you're using just core Ubercart and no contributed modules which may affect this behavior ...

deathL’s picture

Thanks for your answer. Hmm i'm using Product Minimum & Maximum and Ubercart Disable Store also. I can only see addresses property in uc_file_users table and not in uc_files table (only fid and filename).
Oh damn could it be because i've tempered with Workflow rule? I've added new rule:

Events -> Customer starts checkout
Conditions -> User has role(s): admin, authenticate to match any site:current-user
Actions ->

  • Renew the files on an order. Parameter: Order: [order]
  • Update the order status. Parameter: Order: [order], Status: Completed
  • custom Php code:
    $order->order_id = $_SESSION['cart_order'];
    $order->products = uc_cart_get_contents();
    uc_order_save($order);
    
    global $user;
    uc_cart_empty(uc_cart_get_id());
    if ($user->uid > 0) {
      drupal_goto('user/'.$user->uid.'/purchased-files');
    }
deathL’s picture

found a exact situation with a different error: https://drupal.org/node/561692

Edit: i've tested with a fresh project (only core ubercart modules + extra: file download and roles). edited the Rules condition of:

  • Renew purchased files: Data comparison -> Parameter: Data to compare: [updated_order:order-status], Data value: Pending
  • Grant or renew purchased roles: Data comparison -> Parameter: Data to compare: [updated_order:order-status], Data value: Pending

(edited the rules to test download files) and still get the same error :/. i don't know if this helps: i'm testing this on localhost server Xampp

Edit 2:

ok, i have forgotten that normal users will download the files and the test shows that it works. so only admin users will have problems with this. i assume that the answer is described in this issue Corrupt download file and $address error.

TR’s picture

Status: Active » Closed (duplicate)
Issue tags: -download, -addresses, -access

If it's the same as #2133625: Undefined property: stdClass::$addresses in _uc_file_log_download(), then please contribute to that thread to help resolve this.