Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2017
    Location
    Tokyo, Japan
    Posts
    263
    Plugin Contributions
    0

    Default debug log from sidebox more_information.php: change use of sizeof() to !empty()

    Zen Cart 1.5.6c, with define pages 2,3,4 all turned off.
    DB patch level 1.5.6
    PHP 7.3.6-1

    In my debug logs, I found
    # cat logs/myDEBUG-20190725-001038-086304.log
    [25-Jul-2019 00:10:38 Asia/Tokyo] Request URI: /shop/index.php?main_page=time_out, IP address: 192.168.0.3
    #1 sizeof() called at [***/shop/includes/modules/sideboxes/more_information.php:33]
    #2 require(***/shop/includes/modules/sideboxes/more_information.php) called at [***/shop/includes/modules/column_left.php:31]
    #3 require(***/shop/includes/modules/column_left.php) called at [***/shop/includes/templates/gernotshop/common/tpl_main_page.php:136]
    #4 require(***/shop/includes/templates/gernotshop/common/tpl_main_page.php) called at [***/shop/index.php:97]
    --> PHP Warning: sizeof(): Parameter must be an array or an object that implements Countable in ***/shop/includes/modules/sideboxes/more_information.php on line 33.
    Line 33 in the more_information.php sidebox is
    if (sizeof($more_information) > 0) {
    and to solve the issue of $more_information being entirely unset (all the define pages used to populate it are turned off), I change it to
    if (!empty($more_information)) {
    following the advice in:
    https://www.zen-cart.com/showthread....mplate-(stock)
    Zen Cart 1.5.6c modified to support Japanese language (postage module support work in progress). Upgraded incrementally each version from initial 1.5.5d.

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,622
    Plugin Contributions
    123

    Default Re: debug log from sidebox more_information.php: change use of sizeof() to !empty()

    Good job. Do you want to submit a PR for 1.5.7? The fix is needed there.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

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

    Default Re: debug log from sidebox more_information.php: change use of sizeof() to !empty()

    Thanks for posting.

    However, in this case, due to the unset() call and lack of then initializing that variable before using it, I think a better fix is just to set the variable to an empty array, instead of unsetting it.

    Fix applied to v1.5.7 here: https://github.com/zencart/zencart/c...473e6c987356be
    Safe to apply to prior 1.5.x versions.
    .

    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.

  4. #4
    Join Date
    Feb 2017
    Location
    Tokyo, Japan
    Posts
    263
    Plugin Contributions
    0

    Default Re: debug log from sidebox more_information.php: change use of sizeof() to !empty()

    Hi swguy,
    Looks like it might be a better call for Dr. Byte or yourself to decide the final solution here. But I'm happy to submit that then as a PR, yes.
    Zen Cart 1.5.6c modified to support Japanese language (postage module support work in progress). Upgraded incrementally each version from initial 1.5.5d.

  5. #5
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,622
    Plugin Contributions
    123

    Default Re: debug log from sidebox more_information.php: change use of sizeof() to !empty()

    Looks like he took care of it already. Fastest gun in the West! :)
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  6. #6
    Join Date
    Feb 2017
    Location
    Tokyo, Japan
    Posts
    263
    Plugin Contributions
    0

    Default Re: debug log from sidebox more_information.php: change use of sizeof() to !empty()

    Heh :-) Thanks!
    Zen Cart 1.5.6c modified to support Japanese language (postage module support work in progress). Upgraded incrementally each version from initial 1.5.5d.

 

 

Similar Threads

  1. Replies: 11
    Last Post: 21 Dec 2018, 09:06 PM
  2. Replies: 11
    Last Post: 15 Jan 2015, 05:40 PM
  3. Replies: 10
    Last Post: 6 Sep 2014, 02:55 AM
  4. PHP Error - Blank Page w/ log files from debug utility.
    By jester8131 in forum General Questions
    Replies: 2
    Last Post: 5 Feb 2010, 05:35 AM

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