Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Jul 2012
    Posts
    4
    Plugin Contributions
    0

    Default Creating default object from empty value in modules/payment/authorizenet_aim.php

    I recently Upgraded from 1.3a to 1.51 and all seems grand except I am getting 2 log entries in my /logs folder for each purchase. I am using authorize.net AIM in test production.

    1) AIM_Debug_0_blah..blah.log
    2) myDEBUG-adm-blah-blah.og

    The first one looks like an array dump of the cart. The second has the following message:


    PHP Warning: Creating default object from empty value in /home/oregon/public_html/includes/modules/payment/authorizenet_aim.php on line 440


    I looked at like 440 and this is what is there aimdata->fields = array();

    This is the code around that line item.

    function admin_notification($zf_order_id) {
    global $db;
    $output = '';
    $aimdata->fields = array();
    require(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/authorizenet/authorizenet_admin_notification.php');
    return $output;
    }


    Can anyone tell me what the problem might be? Ans how I might fix this problem?

    Thanks,

  2. #2
    Join Date
    Jul 2012
    Posts
    11,627
    Plugin Contributions
    13

    Default Re: Creating default object from empty value in modules/payment/authorizenet_aim.php

    Quote Originally Posted by royndoggy View Post
    I recently Upgraded from 1.3a to 1.51 and all seems grand except I am getting 2 log entries in my /logs folder for each purchase. I am using authorize.net AIM in test production.

    1) AIM_Debug_0_blah..blah.log
    2) myDEBUG-adm-blah-blah.og

    The first one looks like an array dump of the cart. The second has the following message:


    PHP Warning: Creating default object from empty value in /home/oregon/public_html/includes/modules/payment/authorizenet_aim.php on line 440


    I looked at like 440 and this is what is there aimdata->fields = array();

    This is the code around that line item.

    function admin_notification($zf_order_id) {
    global $db;
    $output = '';
    $aimdata->fields = array();
    require(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/authorizenet/authorizenet_admin_notification.php');
    return $output;
    }


    Can anyone tell me what the problem might be? Ans how I might fix this problem?

    Thanks,
    So the first entry appears to be a result of having logging turned on in the modules, payments, authorize.net AIM module, the second, I'm not entirely sure why that line is causing a warning message per se, considering the code in that section has been the same since version 1.5.0. What version of php is used on your system?

    It may also be because in test mode?? Not sure...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  3. #3
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,440
    Plugin Contributions
    9

    Default Re: Creating default object from empty value in modules/payment/authorizenet_aim.php

    There have been numerous changes in the authorizenet files between 1.3.8a and 1.5.1

    Did you apply all the changes in the relevant files?

    Is the module configured correctly in admin?

    I would double-check all of this first before looking any further.

  4. #4
    Join Date
    Jan 2004
    Posts
    64,748
    Blog Entries
    6
    Plugin Contributions
    214

    Default Re: Creating default object from empty value in modules/payment/authorizenet_aim.php

    You are using PHP 5.3 or newer, but Zen Cart 1.5.1 was built for PHP 5.2 or older.
    Continue upgrading a bit further, to v1.5.3 for compatibility with your new PHP version.

    Ref: http://www.zen-cart.com/content.php?...o-run-zen-cart
    .

    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.

  5. #5
    Join Date
    Jul 2012
    Posts
    11,627
    Plugin Contributions
    13

    Default Re: Creating default object from empty value in modules/payment/authorizenet_aim.php

    Quote Originally Posted by DrByte View Post
    You are using PHP 5.3 or newer, but Zen Cart 1.5.1 was built for PHP 5.2 or older.
    Continue upgrading a bit further, to v1.5.3 for compatibility with your new PHP version.

    Ref: http://www.zen-cart.com/content.php?...o-run-zen-cart
    Able to tell/knew the php version because of the error message associated with $variable->field = array(); causing the error or did you go and hunt down/collect something about the OPs site?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  6. #6
    Join Date
    Jan 2004
    Posts
    64,748
    Blog Entries
    6
    Plugin Contributions
    214

    Default Re: Creating default object from empty value in modules/payment/authorizenet_aim.php

    Quote Originally Posted by mc12345678 View Post
    Able to tell/knew the php version because of the error message associated with $variable->field = array(); causing the error or did you go and hunt down/collect something about the OPs site?
    I recall it from fixing:
    "PHP Warning: Creating default object from empty value in .../includes/modules/payment/authorizenet_aim.php ..."
    (also happens in a handful of other places too, not only payment modules ... specifically fixed in v1.5.3)
    .

    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.

  7. #7
    Join Date
    Jul 2012
    Posts
    11,627
    Plugin Contributions
    13

    Default Re: Creating default object from empty value in modules/payment/authorizenet_aim.php

    Quote Originally Posted by DrByte View Post
    I recall it from fixing:
    "PHP Warning: Creating default object from empty value in .../includes/modules/payment/authorizenet_aim.php ..."
    (also happens in a handful of other places too, not only payment modules ... specifically fixed in v1.5.3)
    Hmm interesting. I was working on a product type mod for the rescue that I'm with and I think I was coming across that type of message and thought I was doing something wrong for a different reason. Will have to revisit the code for that issue, thank you.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  8. #8
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    676
    Plugin Contributions
    0

    Default Re: Creating default object from empty value in modules/payment/authorizenet_aim.php

    I was able to fix this issue by changing line 439 from

    Code:
        $aimdata->fields = array();
    to
    Code:
    if (!isset($aimdata)){ 
         $aimdata = new stdClass();
    }
    $aimdata->fields = array();
    Portable 12 Volt Coolers for car truck and RV

  9. #9
    Join Date
    Jul 2012
    Posts
    11,627
    Plugin Contributions
    13

    Default Re: Creating default object from empty value in modules/payment/authorizenet_aim.php

    Quote Originally Posted by bumba000 View Post
    I was able to fix this issue by changing line 439 from

    Code:
        $aimdata->fields = array();
    to
    Code:
    if (!isset($aimdata)){ 
         $aimdata = new stdClass();
    }
    $aimdata->fields = array();
    The if test appears unnecessary when looking at the provided code:
    Code:
    function admin_notification($zf_order_id) {
        global $db;
        $output = '';
        $aimdata->fields = array();
        require(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/authorizenet/authorizenet_admin_notification.php');
        return $output;
      }
    Because there is nothing between the function declaration and the first use of $aimdata-> $aimdata will never be set and therefore the code within the if statement will always be executed. I.e. there is no parameter passed to the function assigned to $aimdata, there's no global $aimdata, and no previous assignment.

    Now if that code section is otherwise modified to attempt to pass/operate differently, then it would be helpful to know how it has been edited.

    The solution referenced earlier in the conversation was to do something similar but as described without the if statement.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  10. #10
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    6,977
    Plugin Contributions
    63

    Default Re: Creating default object from empty value in modules/payment/authorizenet_aim.php

    Quote Originally Posted by mc12345678 View Post
    The if test appears unnecessary when looking at the provided code:
    Code:
    function admin_notification($zf_order_id) {
        global $db;
        $output = '';
        $aimdata->fields = array();
        require(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/authorizenet/authorizenet_admin_notification.php');
        return $output;
      }
    Because there is nothing between the function declaration and the first use of $aimdata-> $aimdata will never be set and therefore the code within the if statement will always be executed. I.e. there is no parameter passed to the function assigned to $aimdata, there's no global $aimdata, and no previous assignment.

    Now if that code section is otherwise modified to attempt to pass/operate differently, then it would be helpful to know how it has been edited.

    The solution referenced earlier in the conversation was to do something similar but as described without the if statement.
    Actually, the following statement is the something that's between the function definition and the first usage.
    Code:
     $aimdata->fields = array();
    Since it's $aimdata->fields that's being assigned that empty array, that's where the issue arises because $aimdata is not an object. I do agree that the change could be simplified as follows to "prepare" for the use of that required handling:
    Code:
    function admin_notification($zf_order_id) {
        global $db;
        $output = '';
        $aimdata = new stdClass();
        $aimdata->fields = array();
        require(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/authorizenet/authorizenet_admin_notification.php');
        return $output;
      }

 

 
Page 1 of 2 12 LastLast

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. v139h Creating default object from empty value (in shipping modules)
    By Phil S in forum General Questions
    Replies: 11
    Last Post: 6 Nov 2015, 06:46 AM
  3. Replies: 20
    Last Post: 7 Dec 2014, 11:29 AM
  4. Replies: 3
    Last Post: 26 Mar 2014, 07:35 PM
  5. Replies: 0
    Last Post: 27 Sep 2012, 11:57 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