Getting Invalid argument supplied for foreach() warrning viewing users purchased files

Project: 
Ubercart
Category: 
bug report
Version: 
Dev version
Priority: 
normal
Status: 
fixed

I just upgraded to new bazaar version and I get an error message viewing purchased files in /user/#/files

* warning: Invalid argument supplied for foreach() in /home/polybonk/polybonk.com/includes/common.inc on line 739.
* warning: strtr() [function.strtr]: The second argument is not an array. in /home/polybonk/polybonk.com/includes/common.inc on line 754.
* warning: Invalid argument supplied for foreach() in /home/polybonk/polybonk.com/includes/common.inc on line 739.
* warning: strtr() [function.strtr]: The second argument is not an array. in /home/polybonk/polybonk.com/includes/common.inc on line 754.

It seems like theres no expire date on the files anymore.

AttachmentSize
Screenshot.png31.58 KB

Re: Getting Invalid argument supplied for foreach() warrning vie

Looks like someone put a parenthesis in the wrong spot. On line 879 of uc_file, the end of the line should look like this:

<?php
  t
('expires on @date', array('@date' => format_date($expiration, 'custom', 'm/d/Y'))) .')');
?>

You get a bug-finder badge.

Re: Re: Getting Invalid argument supplied for foreach() warrning

Just a reminder, this did fix the problem but never was implemented since I updated from bazaar today and got the error again.

Re: Re: Re: Getting Invalid argument supplied for foreach() warr

I committed a different fix for this today along with some other code clean-up in the module.

patch for this problem?

Do you have a patch for this fix?

Thanks,

Re: patch for this problem?

Upgrade to the latest bazaar code.

Re: Re: patch for this problem?

...or just scroll up and change the parenthesis as described in Lyle's post.