Zen Cart Logo
Forums / General Questions / Creating default object from empty value (in shipping modules)

Creating default object from empty value (in shipping modules)

Views: 1,448

Results 1 to 12 of 12
16 Jan 2015, 5:49 PM
#1
phil_s avatar

phil_s

New Zenner

Join Date:
Mar 2008
Posts:
49
Plugin Contributions:
0

Creating default object from empty value (in shipping modules)

v1.3.9h
PHP Version: 5.6.0
Database: MySQL 5.5.27-log

Starting yesterday, my customers are getting the same error message but in the shipping module.
PHP Warning: Creating default object from empty value in .........Cart\includes\modules\shipping_estimator.php on line 107 and once in line 117.

It only seems to happen when someone is not logged in.

I haven't changed anything and can't figure out why this started happening.

16 Jan 2015, 6:12 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Creating default object from empty value (in shipping modules)

See if adding the code in RED fixes the problem in the file:
/includes/modules/shipping_estimator.php

    // set shipping to null ! multipickjup changes address to store address...
    $shipping='';
    // include the order class (uses the sendto !)
    require(DIR_WS_CLASSES . 'order.php');
    $order = new order;
  }else{
[B]    // include the order class (uses the sendto !)
    require(DIR_WS_CLASSES . 'order.php');
    $order = new order;
[/B]    // user not logged in !
    if (isset($_POST['zone_country_id'])){
      // country is selected
      $_SESSION['country_info'] = zen_get_countries($_POST['zone_country_id'],true);
16 Jan 2015, 6:35 PM
#3
phil_s avatar

phil_s

New Zenner

Join Date:
Mar 2008
Posts:
49
Plugin Contributions:
0

Re: Creating default object from empty value (in shipping modules)

That fixed it!

Thank you!

16 Jan 2015, 6:53 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Creating default object from empty value (in shipping modules)

Thanks for the update that this worked for you ...

Do you know if your php recently upgrade?

16 Jan 2015, 6:56 PM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Creating default object from empty value (in shipping modules)

Phil S:

v1.3.9h
PHP Version: 5.6.0
Database: MySQL 5.5.27-log

Starting yesterday, my customers are getting the same error message but in the shipping module.
PHP Warning: Creating default object from empty value in .........Cart\includes\modules\shipping_estimator.php on line 107 and once in line 117.

It only seems to happen when someone is not logged in.

I haven't changed anything and can't figure out why this started happening.
Just a quick note that your site is an accident waiting to happen. Zen Cart v1.3.9h doesn't include the changes that are required for the PHP interface changes made to the built-in htmlspecialchars and htmlentities functions starting with PHP 5.4 -- the default character set changed from (essentially) ASCII to UTF-8.

16 Jan 2015, 7:16 PM
#6
phil_s avatar

phil_s

New Zenner

Join Date:
Mar 2008
Posts:
49
Plugin Contributions:
0

Re: Creating default object from empty value (in shipping modules)

No according the my son, he hadn't changed anything.

I suppose it's time to upgrade to v1.5.4 but I'm old and don't like changes. :)

17 Jan 2015, 1:18 PM
#7
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Creating default object from empty value (in shipping modules)

Phil S:

No according the my son, he hadn't changed anything.

I suppose it's time to upgrade to v1.5.4 but I'm old and don't like changes. :)
Understood, but it's a lot easier to make a change when you ***want ***to instead of when you ***have ***to (i.e. when your store is no longer working).

7 Apr 2015, 12:11 AM
#8
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Re: Creating default object from empty value (in shipping modules)

Does the below fix also work in 1.5.1? as for some reason i thought the fix was a lot more convoluted than that, just asking as i am about to apply the fix and it just seems so much simpler than last time>

Ajeh:

See if adding the code in RED fixes the problem in the file:
/includes/modules/shipping_estimator.php

// set shipping to null ! multipickjup changes address to store address...
$shipping='';
// include the order class (uses the sendto !)
require(DIR_WS_CLASSES . 'order.php');
$order = new order;

}else{
[B] // include the order class (uses the sendto !)
require(DIR_WS_CLASSES . 'order.php');
$order = new order;
[/B]
// user not logged in !
if (isset($_POST['zone_country_id'])){
// country is selected
$_SESSION['country_info'] = zen_get_countries($_POST['zone_country_id'],true);

6 Nov 2015, 3:26 AM
#9
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Creating default object from empty value (in shipping modules)

same error appearing for includes/modules/shipping_rates_in_cart.php

Apply same fix and it seems to work but making shopping cart page to load slow now. Any idea how to change it so it does not take long to load?

6 Nov 2015, 3:33 AM
#10
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Creating default object from empty value (in shipping modules)

jsarwar:

same error appearing for includes/modules/shipping_rates_in_cart.php

Apply same fix and it seems to work but making shopping cart page to load slow now. Any idea how to change it so it does not take long to load?

The fix to the problem as detailed in this thread will not be the cause of slow loading pages.

There may be something coincidental going on that is making you think the fix and slowness are related, but for the life of me I can't imagine what the connection would be.

Cheers
RodG

6 Nov 2015, 3:45 AM
#11
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Creating default object from empty value (in shipping modules)

It is as as soon as I remove this code page load fast. Also I added this code on line 117 then it start giving same error for line 107 and others. So do I add same code on each of these lines?

6 Nov 2015, 5:46 AM
#12
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Creating default object from empty value (in shipping modules)

jsarwar:

It is as as soon as I remove this code page load fast.

Hmmm, yes well, <speculation> without the added code the server will effectively 'die' when it reaches that part of the code, or at the very least, not have all it needs to continue the processing, so it would stand to reason that it would return back to the caller function a lot quicker with the error than if it had all it needed and was able to continue its normal processing.

I'm not saying this IS the case or the reason, but it is almost certainly one of the possible things you haven't considered.

jsarwar:

Also I added this code on line 117 then it start giving same error for line 107 and others. So do I add same code on each of these lines?

Sorry, but I can't really answer this with any degree of confidence. I don't have the code in front of me. I do see mention of both of these line numbers in the earlier posts in this thread that would seem to imply that the 'fix' needs to be applied in each instance that has the problem though.

The fact that it (apparently) started to give the same error on a different line (117) after taking care of the problem in line 107 would tend to support my speculation that the reason the 'fix' is making things slower really is because it is now getting to process more of the code, and this being the case, and going back to your original question of "Any idea how to change it so it does not take long to load?" the answer will be "you can't". It isn't that the fixes are making it slower, it is that the fixes are making it work - and work always seems to take a lot more time than not having to work. :-)

Cheers
RodG