Page 4 of 4 FirstFirst ... 234
Results 31 to 37 of 37
  1. #31
    Join Date
    Apr 2010
    Posts
    265
    Plugin Contributions
    1

    Default Re: Parameter must be an array or an object that implements Countable in shopping car

    I just had a bot from russia go through my website, and spam me with product inquiry emails, but they also set over 3500 errors in the log folder. The most common one was the same as the first post here. Any suggestions to keep this from happening again? It takes forever to empty out the logs folder in filezilla.

  2. #32
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,145
    Plugin Contributions
    11

    Default Re: Parameter must be an array or an object that implements Countable in shopping car

    6500 here.

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

    Default Re: Parameter must be an array or an object that implements Countable in shopping car

    Change line from:
    Code:
    for ($i=0, $n=sizeof($_POST['products_id']); $i<$n; $i++) {
    to:
    Code:
    for ($i=0, $n=sizeof($_POST['products_id'] ?? []); $i<$n; $i++) {
    I was able to reproduce the "issue" though its relatively obviously not through normal page load...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

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

    Default Re: Parameter must be an array or an object that implements Countable in shopping car

    Quote Originally Posted by mc12345678 View Post
    Change line from:
    Code:
    for ($i=0, $n=sizeof($_POST['products_id']); $i<$n; $i++) {
    to:
    Code:
    for ($i=0, $n=sizeof($_POST['products_id'] ?? []); $i<$n; $i++) {
    I was able to reproduce the "issue" though its relatively obviously not through normal page load...
    That is, assuming php 7.x is being used. If for some reason/some how php 5.x is being used then modify the original line changing
    $_POST['products_id'] to:
    !empty($_POST['products_id']) ? $_POST['products_id'] : array()

    FYI, I used !empty instead of isset to more clearly direct to an empty array instead of the literal translation of ?? which is the null coelesce operator that supposedly does a check against isset. The null coelesce operator works more succinctly than this longer logic/assignment.
    Last edited by mc12345678; 25 Sep 2020 at 04:17 AM.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #35
    Join Date
    Apr 2010
    Posts
    265
    Plugin Contributions
    1

    Default Re: Parameter must be an array or an object that implements Countable in shopping car

    Thank you for the fix. My logs folder has been empty for almost 48 hours now.
    I banned the ip address that was spamming my site that day, because it looked at almost 2,000 pages in 10 minutes, according to my tracking software.

  6. #36
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,684
    Plugin Contributions
    123

    Default Re: Parameter must be an array or an object that implements Countable in shopping car

    MC's fix has been added to 1.5.7a. Thanks, @mc12345678!
    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.

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

    Default Re: Parameter must be an array or an object that implements Countable in shopping car

    Quote Originally Posted by vanhorn_s View Post
    Thank you for the fix. My logs folder has been empty for almost 48 hours now.
    I banned the ip address that was spamming my site that day, because it looked at almost 2,000 pages in 10 minutes, according to my tracking software.
    Quote Originally Posted by swguy View Post
    MC's fix has been added to 1.5.7a. Thanks, @mc12345678!
    Well, something like it anyways.

    After I discovered one method of reproducing the problem and the associated solution above, I found a separate way to cause a similar issue (even with the above applied) so came up with a more complete solution that involved minimal modification. There may be ways in the future to do things differently and there may be those here that figure out that different process.

    Anyways, the currently approved solution is: https://github.com/zencart/zencart/pull/3976/files

    While the original modification seemed to resolve the issue, it also depends on what it is the actor is trying to do as to the need for additional evaluation/action.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 4 of 4 FirstFirst ... 234

Similar Threads

  1. Replies: 3
    Last Post: 24 Dec 2019, 08:16 AM
  2. Replies: 11
    Last Post: 21 Dec 2018, 09:06 PM
  3. Replies: 7
    Last Post: 16 Dec 2018, 04:00 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