Thread: Please Help!!

Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2017
    Location
    Fort Worth, TX
    Posts
    10
    Plugin Contributions
    0

    Default Please Help!!

    My url is: https://mhmr.fwpromo.com/
    Version: 1.5.1
    No Added Plugins.

    I am unable to add products to my catalog! I receive these errors in my logs every time I try, after filling in all the info and clicking "preview":

    PHP Warning: reset() expects parameter 1 to be array, null given in /home/fwpromo9/public_html/mhmr/zcadmin/includes/classes/object_info.php on line 29

    PHP Warning: Variable passed to each() is not an array or object in /home/fwpromo9/public_html/mhmr/zcadmin/includes/classes/object_info.php on line 30

    Here is the contents of object_info.php

    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2003 The zen-cart developers |
    // | |
    // | http://www.zen-cart.com/index.php |
    // | |
    // | Portions Copyright (c) 2003 osCommerce |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license, |
    // | that is bundled with this package in the file LICENSE, and is |
    // | available through the world-wide-web at the following url: |
    // | http://www.zen-cart.com/license/2_0.txt. |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to |
    // | [email protected] so we can mail you a copy immediately. |
    // +----------------------------------------------------------------------+
    // $Id: object_info.php 1969 2005-09-13 06:57:21Z drbyte $
    //

    class objectInfo {

    // class constructor
    function objectInfo($object_array) {
    //this line should be added, but should be tested first:
    // if (!is_array($object_array)) return;
    reset($object_array);
    while (list($key, $value) = each($object_array)) {
    $this->$key = zen_db_prepare_input($value);
    }
    }
    }
    ?>


    The website works great, but has not been touched since 2015. All of a sudden I was asked to add a few products and BOOM!! The only thing I know has changed was that I added SSL security (https:) I did not build the website, and am just learning the Zen Cart way of doing things, but really need help with this. I have spent 3 days trying to figure it out.
    Last edited by JustRight; 23 Mar 2017 at 10:14 PM. Reason: Added screenshot

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,685
    Plugin Contributions
    9

    Default Re: Please Help!!

    try changing the code as such:

    Code:
    class objectInfo {
    
    // class constructor
    function objectInfo($object_array) {
    //this line should be added, but should be tested first:
    if (!is_array($object_array)) return;
    reset($object_array);
    while (list($key, $value) = each($object_array)) {
    $this->$key = zen_db_prepare_input($value);
    }
    }
    }
    ?>
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    Feb 2017
    Location
    Fort Worth, TX
    Posts
    10
    Plugin Contributions
    0

    Default Re: Please Help!!

    No Change I feel stupid for not catching the fact that the first line was commented out though.

  4. #4
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,685
    Plugin Contributions
    9

    Default Re: Please Help!!

    something is adrift....

    null is not an array; therefore this function should return prior to hitting the reset.

    are you sure the debug logs are exactly the same as before? i would ensure that you in the correct spot in the code.

    Code:
        /**
         * @param $object_array
         */
        function objectInfo($object_array)
        {
            if (!is_array($object_array)) return;
            reset($object_array);
            while (list($key, $value) = each($object_array)) {
                $this->$key = zen_db_prepare_input($value);
            }
        }
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  5. #5
    Join Date
    Feb 2017
    Location
    Fort Worth, TX
    Posts
    10
    Plugin Contributions
    0

    Default Re: Please Help!!

    The exact same. I have about 200 logs (all from the past 4 days) and ALL of them are the exact same. I am glad to see someone else is stumped. I am just trying to add more product to sell. I tried to add a category as well, it added the category, but it was completely blank. No Words, not even the title of the category saved, just a blank space. It seems none of my words are getting sent to the database, but obviously the database is connected correctly since it draws the information for the store, and everything works.

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

    Default Re: Please Help!!

    You said you're using Zen Cart v1.5.1 ... which is designed for PHP 5.2 and 5.3.
    What version of PHP is your server currently using? Perhaps your host upgraded it, and now your 2012 version of Zen Cart also needs some upgrading?

    You can see your PHP version by clicking the "Version" link in the top right corner of your Admin, or going to Admin->Tools->Server Info.
    .

    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
    Feb 2017
    Location
    Fort Worth, TX
    Posts
    10
    Plugin Contributions
    0

    Default Re: Please Help!!

    PHP version 5.3.29. That was one of the first things I checked.

  8. #8
    Join Date
    Feb 2017
    Location
    Fort Worth, TX
    Posts
    10
    Plugin Contributions
    0

    Default Re: Please Help!!

    While still working on this, and hoping someone can help, I am also in the process of building a test to see if I can get it the exact same, with an upgraded version of Zen-Cart 1.5.5e. If I can just upgrade to a new version and be able to use the PHP 7.1 then maybe I can get past this. Problem is I have to be careful to exactly match the previous version as far as settings.

  9. #9
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,685
    Plugin Contributions
    9

    Default Re: Please Help!!

    the error log is pointing you to the exact line and problem. the variable $object_array is NOT an array and therefor this function should just return.

    you could try adding the following line just above the if statement:

    Code:
    if (is_null($object_array)) return;
    i would delete all of your debug logs and then look at the new one that gets created.

    as a test, you could also add the following code above the if statement:

    Code:
    print_r($object_array);
    die(__FILE__ . ':' . __LINE__);
    and then you can see what the $object_array actually is when you try to add a product, and you should NOT get any debug logs as the script ends before the error occurs.

    starting out with php may be daunting at first; but unless i'm missing something, the debug log is pointing to exactly what the problem is.

    i would delete all of the old debug logs and then post any new debug logs along with your code for this class.

    good luck!
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  10. #10
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Please Help!!

    Don't know if this one has been solved or not, but as far as the warnings, work from top down. The first issue is the trigger or "problem" the remaining, well pretty much is just extra info. Need to focus on why the reset was provided an object that was null instead of an array to be reset, all the rest is not valuable/an issue to yet try to resolve.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v150 $db-Execute() issue with fields... Please please please help.
    By Ooba_Scott in forum General Questions
    Replies: 11
    Last Post: 3 Oct 2012, 09:36 AM
  2. Replies: 4
    Last Post: 1 Oct 2010, 05:09 AM
  3. Please Please HELP! Cross Sell not working... Any ideas People?
    By jorsara in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 23 Mar 2010, 12:08 AM
  4. Please anybody please help with Scrolling Sidebox Mod. in IE8
    By hcd888 in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 2 Oct 2009, 03:42 AM
  5. Please help please!Premature end of script headers: index.php (null)
    By fangzhouws in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 11 Aug 2006, 06:05 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