Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default [Done v1.5.4] PHP 5.4 PHP Warning: Creating default object from empty value

    This is an informational post...hopefully it will save someone else the time I spent on this.

    After upgrading my local Windows 7 test server to Xampp 1.80: php 5.4.4 I started getting debug logs being created from the admin.

    [27-Sep-2012 16:10:25 UTC] PHP Warning: Creating default object from empty value in D:\blah blah\public_html\tienda\MY_ADMIN\categories.php on line 1018

    Which is:
    PHP Code:
                      if (empty($pInfo->products_id)) {
    line 1018         $pInfo->products_id$pID
    It happens in Admin->Catalog->Categories/Products when doing a search that yields a result that includes categories (but for no result/a result with products only,..no debug log is created).

    I have a copy of my shop (upgraded to 1.51) and a vanilla 1.51 install on the same server. The vanilla install did not cause the debug log.

    As it was “obviously” a problem with my shop I spent a lot of time investigating that avenue...nothing.

    The error reporting seemed to be the same in the shop files and ZC151 files, and php.ini between the old Xampp 1.73 php 5.3.1. and the new 1.80 php 5.4.4.

    Eventually I found that in php 5.4 the buggers have included E_STRICT error reporting in E_ALL so the warnings were from E_STRICT being implemented: obvious when you work with php all the time..which I don’t.

    Further to this adding the extra line cures the warning.

    PHP Code:
      if (empty($pInfo->products_id)) {
    $pInfo = new stdClass();    
    $pInfo->products_id$pID
    So....why does the vanilla ZC151 not produce the error? Obviously there's an E_ALL lurking somewhere in my files but I’ve looked at all the instances of E_ALL in my shop and the vanilla, and commented out any extras in my mods...still haven’t found why there is a difference in the error reporting...so this post does not go in the bug reports!
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  2. #2
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,896
    Blog Entries
    2
    Plugin Contributions
    2

    Default Re: PHP 5.4 Error Reporting E_STRICT in E_ALL causing a warning debug log on my site

    moved to bug reports forum.

    Will investigate and schedule a fix where necessary.

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

    Default Re: PHP 5.4 Error Reporting E_STRICT in E_ALL causing a warning debug log on my site

    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,404
    Plugin Contributions
    87

    Default Re: PHP 5.4 Error Reporting E_STRICT in E_ALL causing a warning debug log on my site

    Also occurs for /admin/products_price_manager.php:
    Code:
    [22-Nov-2012 16:18:43 Europe/Berlin] PHP Warning:  Creating default object from empty value in C:\xampp\htdocs\v1.5.1\myadmin\products_price_manager.php on line 476
    
    [22-Nov-2012 16:18:43 Europe/Berlin] PHP Warning:  Creating default object from empty value in C:\xampp\htdocs\v1.5.1\myadmin\products_price_manager.php on line 482

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,404
    Plugin Contributions
    87

    Default Re: PHP 5.4 Error Reporting E_STRICT in E_ALL causing a warning debug log on my site

    Also occurs for /includes/modules/shipping_estimator.php:
    Code:
    [25-Nov-2012 16:22:21 Europe/Berlin] PHP Warning:  Creating default object from empty value in C:\xampp\htdocs\mystore\includes\modules\shipping_estimator.php on line 107
    Code:
    [27-Nov-2012 17:29:35 Europe/Berlin] PHP Warning:  Creating default object from empty value in C:\xampp\htdocs\mystore\includes\modules\shipping_estimator.php on line 117
    It looks like the solution for this one might be (starting at line 63 of the v1.5.1 module):
    Code:
      //if($cart->get_content_type() !== 'virtual') {
      require(DIR_WS_CLASSES . 'order.php');
      $order = new order;
      if ($_SESSION['customer_id']) {
        // user is logged in
        if (isset($_POST['address_id'])){
          // user changed address
          $sendto = $_POST['address_id'];
        }elseif ($_SESSION['cart_address_id']){
          // user once changed address
          $sendto = $_SESSION['cart_address_id'];
          //        $sendto = $_SESSION['customer_default_address_id'];
        }else{
          // first timer
          $sendto = $_SESSION['customer_default_address_id'];
        }
        $_SESSION['sendto'] = $sendto;
        // set session now
        $_SESSION['cart_address_id'] = $sendto;
        // 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{
        // user not logged in !

  6. #6
    Join Date
    Aug 2006
    Posts
    76
    Plugin Contributions
    0

    Default PHP 5.4 and PHP Errors

    I think we can consider this minor as it doesnt seem to have caused any issues on any of our sites but our host 1and1.com is requiring everyone to upgrade to php 5.4 before April 1st, and when doing so the myDEBUG files in the cache folder start growing like crazy with these warnings.

    I have not edited any of these core files.

    PHP Warning: Creating default object from empty value in /homepages/38/d436025994/htdocs/includes/modules/payment/authorizenet_aim.php on line 429

    This error in the authorize module refers to this line in the admin_notifications function $aimdata->fields = array();

    PHP Warning: Illegal string offset 'id' in /homepages/38/d436025994/htdocs/includes/modules/payment/paypalwpp.php on line 199

    This refers to the update_status function and this line of code: $sql = $db->bindVars($sql, ':countryId', $order->billing['country']['id'], 'integer');

    Again neither core files have been touched. And these errors do not show if we revert back to PHP 5.3.

    If you have a quick fix to keep the log files from getting crazy (other than shutting it off) please let me know.

  7. #7
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: PHP 5.4 and PHP Errors

    To address these warnings, add the highlighted changes to your code:
    Quote Originally Posted by Kamino84 View Post
    PHP Warning: Creating default object from empty value in /homepages/38/d436025994/htdocs/includes/modules/payment/authorizenet_aim.php on line 429
    Code:
      function admin_notification($zf_order_id) {
        global $db;
        $output = '';
        $aimdata = new stdClass;
        $aimdata->fields = array();
    Quote Originally Posted by Kamino84 View Post
    PHP Warning: Illegal string offset 'id' in /homepages/38/d436025994/htdocs/includes/modules/payment/paypalwpp.php on line 199
    Code:
      function update_status() {
        global $order, $db;
    //    $this->zcLog('update_status', 'Checking whether module should be enabled or not.');
        if ($this->enabled && (int)$this->zone > 0 && isset($order->billing['country']['id'])) {
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Aug 2006
    Posts
    76
    Plugin Contributions
    0

    Default Re: PHP 5.4 and PHP Errors

    Thanks for the quick reply and fix. As mentioned before I dont think it was causing an problems with the software functioning just a log file mess when they start to stack up. It appears php 5.4 is a bit more strict with the calling of objects and error logging.

  9. #9
    Join Date
    Aug 2011
    Location
    Tampa Bay, Florida USA
    Posts
    17
    Plugin Contributions
    0

    help question Shipping estimator not working correctly ERROR MSG.


    [07-Feb-2013 05:33:03 Australia/Melbourne] PHP Warning: Creating default object from empty value in /homepages/../../htdocs/store/includes/modules/shipping_estimator.php on line 117

    thanks, Lora

  10. #10
    Join Date
    Aug 2011
    Location
    Tampa Bay, Florida USA
    Posts
    17
    Plugin Contributions
    0

    Default Re: Shipping estimator not working correctly ERROR MSG.

    it also has the same error message for line 117, 107, 92

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 7 Sep 2016, 03:42 PM
  2. 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
  3. Replies: 10
    Last Post: 6 Sep 2014, 02:55 AM
  4. v151 "PHP Warning: Creating default object from empty value" what is this?
    By gsmsalers in forum General Questions
    Replies: 3
    Last Post: 9 May 2014, 06:54 PM
  5. Replies: 3
    Last Post: 26 Mar 2014, 07:35 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR