Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2009
    Posts
    69
    Plugin Contributions
    0

    Default "PHP Warning: Creating default object from empty value" what is this?

    Hi.
    My Zencart version is 1.51.
    My website was working perfectly on my test live server, until I migrated hosting to another server. Then I got several bugs, which might be caused by PHP version incompatibility. First I dealt below problem.
    http://www.zen-cart.com/showthread.p...xhausted/page2

    Now I got below error log file. Something is wrong in admin area.
    [25-Nov-2013 02:48:41 UTC] PHP Warning: Creating default object from empty value in /home/myhosting/public_html/admin/categories.php on line 986

    What is this problem?

  2. #2
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: "PHP Warning: Creating default object from empty value" what is this?

    Quote Originally Posted by gsmsalers View Post
    Hi.
    My Zencart version is 1.51.
    My website was working perfectly on my test live server, until I migrated hosting to another server. Then I got several bugs, which might be caused by PHP version incompatibility. First I dealt below problem.
    http://www.zen-cart.com/showthread.p...xhausted/page2

    Now I got below error log file. Something is wrong in admin area.
    [25-Nov-2013 02:48:41 UTC] PHP Warning: Creating default object from empty value in /home/myhosting/public_html/admin/categories.php on line 986

    What is this problem?
    Would need to look at the file /admin/categories.php then look at line 986; however, believe this statement has been discussed recently related upgrading to PHP 5.4. If not mistaken that line uses a variable that hasn't previously been declared, and therefore the warning.

    The fix they had (which was for a different application) was similar to: $variable = new variable_type

    where variable_type might be a class or other type of variable.

    Though still looking through categories.php, it looks like there are case statements that assign one or both variables used on that line. Thing is that I haven't been able to determine if every case statement makes a guaranteed statement, even if it is to declare the variable(s), but it could be possible that the path taken by the data excluded assignment of one or both of the variables associated with that line.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,839
    Plugin Contributions
    31

    Default Re: "PHP Warning: Creating default object from empty value" what is this?

    These are not bugs as such, just php error reporting getting stricter and tightening the "rules".
    I would have said just have a look at the corresponding files in the 1.60 files on Github for a clue...but I have done that and didn't see the obvious answer so...some input required from the cognescenti.
    Steve
    github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

  4. #4
    Join Date
    May 2008
    Location
    Near the water, somewhere...
    Posts
    126
    Plugin Contributions
    0

    help question Re: "PHP Warning: Creating default object from empty value" what is this?

    *Bump.* I'm on 1.5.1.

    Hopefully not a big deal, but I'd like to find if there's a
    known fix to this by now that I can read and implement.
    I just noticed I've been receiving similar log notices in
    my log file:

    [09-May-2014 11:01:24 America/New_York] PHP Warning: Creating default object from empty value in /storeLocation/includes/modules/shipping_estimator.php on line 117

    Here's a snippet from shipping_estimator.php, and a little
    bookmark code before and after. I've indicated by a
    comment where my line 117 is in the code.

    PHP Code:
        // user not logged in !
        
    if (isset($_POST['zone_country_id'])){
          
    // country is selected
          
    $_SESSION['country_info'] = zen_get_countries($_POST['zone_country_id'],true);
          
    $country_info $_SESSION['country_info'];
          
    $order->delivery = array('postcode' => $zip_code,
                                   
    'country' => array('id' => $_POST['zone_country_id'], 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
                                   
    'country_id' => $_POST['zone_country_id'],
                                   
    //add state zone_id
                                   
    'zone_id' => $state_zone_id,
                                   
    'format_id' => zen_get_address_format_id($_POST['zone_country_id']));
          
    $_SESSION['cart_country_id'] = $_POST['zone_country_id'];
          
    //add state zone_id
          
    $_SESSION['cart_zone'] = $state_zone_id;
          
    $_SESSION['cart_zip_code'] = $zip_code;
        } elseif (
    $_SESSION['cart_country_id']){
          
    // session is available
          
    $_SESSION['country_info'] = zen_get_countries($_SESSION['cart_country_id'],true);
          
    $country_info $_SESSION['country_info'];
          
    // fix here - check for error on $cart_country_id
          
    $order->delivery = array('postcode' => $_SESSION['cart_zip_code'],
                                   
    'country' => array('id' => $_SESSION['cart_country_id'], 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
                                   
    'country_id' => $_SESSION['cart_country_id'],
                                   
    'zone_id' => $state_zone_id,
                                   
    'format_id' => zen_get_address_format_id($_SESSION['cart_country_id']));
        } else {
          
    // first timer
          
    $_SESSION['cart_country_id'] = STORE_COUNTRY;
          
    $_SESSION['country_info'] = zen_get_countries(STORE_COUNTRY,true);
          
    $country_info $_SESSION['country_info'];
          
    //**************************
          // line 117 follows
          //**************************
          
    $order->delivery = array(//'postcode' => '',
                                   
    'country' => array('id' => STORE_COUNTRY'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
                                   
    'country_id' => STORE_COUNTRY,
                                   
    'zone_id' => $state_zone_id,
                                   
    'format_id' => zen_get_address_format_id($_POST['zone_country_id']));
        }
        
    // set the cost to be able to calculate free shipping
        
    $order->info = array('total' => $_SESSION['cart']->show_total(), // TAX ????
                             
    'currency' => $currency,
                             
    'currency_value'=> $currencies->currencies[$currency]['value']);
      } 
    Warm regards,

    Doug

 

 

Similar Threads

  1. v139h Warning: Creating default object from empty value in shipping_estimator.php
    By split63 in forum Built-in Shipping and Payment Modules
    Replies: 6
    Last Post: 30 Apr 2016, 08:00 PM
  2. Replies: 20
    Last Post: 7 Dec 2014, 11:29 AM
  3. Replies: 10
    Last Post: 6 Sep 2014, 02:55 AM
  4. Replies: 3
    Last Post: 26 Mar 2014, 07:35 PM
  5. Replies: 0
    Last Post: 27 Sep 2012, 11:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg