Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Feb 2009
    Posts
    46
    Plugin Contributions
    0

    Default strrpos() expects parameter 1 to be string, array given in functions_categories.php

    I just upgraded to 1.3.9h, my cache file suddenly filled up myDebug logs.
    What it says is
    [11-Feb-2011 05:29:24] PHP Warning: strrpos() expects parameter 1 to be string, array given in /EDITED/includes/functions/functions_categories.php on line 484
    Here are lines 477-514

    Code:
    // Get all products_id in a Category and its SubCategories
    // use as:
    // $my_products_id_list = array();
    // $my_products_id_list = zen_get_categories_products_list($categories_id)
      function zen_get_categories_products_list($categories_id, $include_deactivated = false, $include_child = true, $parent_category = '0', $display_limit = '') {
        global $db;
        global $categories_products_id_list;
     484   $childCatID = str_replace('_', '', substr($categories_id, strrpos($categories_id, '_')));
    
        $current_cPath = ($parent_category != '0' ? $parent_category . '_' : '') . $categories_id;
    
        $sql = "select p.products_id
                from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
                where p.products_id = p2c.products_id
                and p2c.categories_id = '" . (int)$childCatID . "'" .
                ($include_deactivated ? " and p.products_status = 1" : "") .
                $display_limit;
    
        $products = $db->Execute($sql);
        while (!$products->EOF) {
          $categories_products_id_list[$products->fields['products_id']] = $current_cPath;
          $products->MoveNext();
        }
    
        if ($include_child) {
          $sql = "select categories_id from " . TABLE_CATEGORIES . "
                  where parent_id = '" . (int)$childCatID . "'";
    
          $childs = $db->Execute($sql);
          if ($childs->RecordCount() > 0 ) {
            while (!$childs->EOF) {
              zen_get_categories_products_list($childs->fields['categories_id'], $include_deactivated, $include_child, $current_cPath, $display_limit);
              $childs->MoveNext();
            }
          }
        }
        return $categories_products_id_list;
      }
    Any idea why this error is occuring?

    I upgraded from 1.3.8, by doing a new install with a new database, I then moved all my stuff into the new database, deleted my old files and moved the new files into their place and I kept the new data base. The only thing I've added afterwards is the Facebook open graph add on.

    Side note, I just put my site in down for Maintenance and I'm not getting any error logs
    Dan
    Last edited by kashyyyk; 11 Feb 2011 at 06:58 AM.

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Function_Catagories.php myDebug errors

    If you go to the Tools ... Developers Tool Kit ... and in the bottom input box enter:
    zen_get_categories_products_list

    Select Catalog ... and click Search ...

    What files do you see using this function and how are they calling it?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Function_Catagories.php myDebug errors

    strrpos($categories_id, '_') thinks it is getting a number when it wants a string. Normally, this works automatically, but if something has referenced $categories_id as a number just before the function is called, it could misfire.

  4. #4
    Join Date
    Feb 2009
    Posts
    46
    Plugin Contributions
    0

    Default Re: Function_Catagories.php myDebug errors

    Doing the search I got the following response
    -
    / /includes/functions/functions_categories.php

    Line #479 : // $my_products_id_list = zen_get_categories_products_list($categories_id)

    Line #480 : function zen_get_categories_products_list($categories_id, $include_deactivated = false, $include_child = true, $parent_category = '0', $display_limit = '') {

    Line #507 : zen_get_categories_products_list($childs->fields['categories_id'], $include_deactivated, $include_child, $current_cPath, $display_limit);



    / /includes/modules/featured_products.php

    Line #31 : $productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit);



    / /includes/modules/new_products.php

    Line #30 : $productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit);



    / /includes/modules/specials_index.php

    Line #31 : $productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit);



    /home/www/phryz.com/includes/modules/upcoming_products.php

    Line #33 : $productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit);


    Dan

  5. #5
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Function_Catagories.php myDebug errors

    Well ... that is where you should see the calls to it ... I am not seeing the cause of this ...

    The best thing to do would be to check the files on the server with a clean Zen Cart v1.3.9h with something like Beyond Compare from scootersoftware.com and see if you can see any damaged, missing or otherwised altered files that might be causing this ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  6. #6
    Join Date
    Feb 2009
    Posts
    46
    Plugin Contributions
    0

    Default Re: Function_Catagories.php myDebug errors

    Ok, I'll try that, would it be any of the pages listed from the search inquiry, or any page at all.

    Dan

  7. #7
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Function_Catagories.php myDebug errors

    Those are the pages using the function ... they might help you determine where the paramater values are incorrect for the function ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  8. #8
    Join Date
    Feb 2009
    Posts
    46
    Plugin Contributions
    0

    Default Re: Function_Catagories.php myDebug errors

    I'm going to start comparing later tonight or tomorrow, and I'm looking for a hint on what to look for if possible.

    I'm in maintance mode and it has generated no myDebug errors since I've been in that mode, I can move around my site and do searches and all and I get no myDebug errors, now when I ran that search query it generated 5 myDebug errors, I'm assuming once for each of the pages it returned.

    I'm hoping that will help

    Thanks
    Dan

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

    Default Re: Function_Catagories.php myDebug errors

    If the admin search is generating MORE error logs, then it's very likely that the DETAILS of those errors are different than the ones which were triggered by trying to draw the categories list on your storefront.
    .

    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.

  10. #10
    Join Date
    Feb 2009
    Posts
    46
    Plugin Contributions
    0

    Default Re: Function_Catagories.php myDebug errors

    I just ran it again to see what the errors are and none generated, it must have been 5 I missed when clearing out the cache

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 3
    Last Post: 6 Jun 2016, 02:37 AM
  2. PHP Warning: addslashes() expects parameter 1 to be string, array given
    By schoolboy in forum All Other Contributions/Addons
    Replies: 11
    Last Post: 10 May 2013, 02:19 PM
  3. v139e PHP Warning: strlen() expects parameter 1 to be string, array given in
    By irishshopper in forum Basic Configuration
    Replies: 4
    Last Post: 7 Mar 2013, 08:06 PM
  4. v139h PHP Warning: strip_tags() expects parameter 1 to be string, array given
    By BlessIsaacola in forum General Questions
    Replies: 1
    Last Post: 6 Mar 2012, 01:32 PM
  5. v150 PHP Warning: strlen() expects parameter 1 to be string, array given
    By caffeitalia in forum General Questions
    Replies: 1
    Last Post: 1 Feb 2012, 03:17 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