VirtueMart Forum

VirtueMart 2 + 3 + 4 => Installation, Migration & Upgrade => Topic started by: sagepos on September 10, 2012, 04:25:00 AM

Title: Warning: Creating default object from empty value in...
Post by: sagepos on September 10, 2012, 04:25:00 AM
When I click "SHOP", I get the following message:

Warning: Creating default object from empty value in C:\xampp\htdocs\administrator\components\com_virtuemart\helpers\shopfunctions.php on line 278

The code below contains line 278:
   $countries_list=array();
      $i=0;
       foreach ($sorted_countries as  $key=>$value) {
           $countries_list[$i]->$id = $key;                  ///Line 278
         $countries_list[$i]->$name = $value;
          $i++;

The error message fills the whole page when I click the SHOP button.
When I rem the above code, the Shop will open just fine.  However, I can't make changes and save them because it requires country/state information which doesn't load because the above code is remmed.
When I unrem the code, it goes back to giving me the line 278 messages...

Any idea what my problem is?

Thanks,
Bryan Moore
Title: Re: Warning: Creating default object from empty value in...
Post by: vaistik on September 10, 2012, 11:46:46 AM
I've run in the same issue, clean install.

I know it's just a warning and I could hide it but I want it to be clean.

I guess it appears because it treats an array as an object. Any ideas on how to resolve this?

Cheers!
Title: Re: Warning: Creating default object from empty value in...
Post by: jenkinhill on September 10, 2012, 13:14:45 PM
What version of PHP are you using?

@sagepos you can just suppress the warning to be able to continue to develop the site. The function still works.  http://forum.virtuemart.net/index.php?topic=102555.0
Title: Re: Warning: Creating default object from empty value in...
Post by: vaistik on September 11, 2012, 09:45:14 AM
Hi and thanks for the reply.

I'm using 5.4.6

Edit: Tried it on 5.3.16 and works fine.
Title: Re: Warning: Creating default object from empty value in...
Post by: jenkinhill on September 11, 2012, 13:27:49 PM
Joomla 2.5 has problems with PHP5.4+ and VM2 has not yet been optimised for it - too many people are using PHP5.2 even now.
Title: Re: Warning: Creating default object from empty value in...
Post by: fiore on September 16, 2012, 15:34:41 PM
I'm using Joomla version 2.57 and php version 5.4.4
That's ok!!

But I found the problem with VirtueMart 2.0.10 in line 278 as above mail. >.<
Title: Re: Warning: Creating default object from empty value in...
Post by: MLucian on September 18, 2012, 09:08:52 AM
I had the same problem as sagepos. PHP Version 5.4.4, MySQL 5.5, Apache 2.4.2. Just go to joomla golbal configuration page, server tab and set error reporting to none.
Title: Re: Warning: Creating default object from empty value in...
Post by: fiore on September 23, 2012, 09:21:50 AM
OK.

Set error is none. That's work!!

thx.