Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 05:40 pm EDT

Geeklog Forums

count(): Parameter must be an array or an object that implements Countable


Status: offline

alb3rt

Forum User
Regular Poster
Registered: 10/30/06
Posts: 71
Location:Mexico City
Hello everybody,

I am getting an error to the "My account" section (~/usersettings.php), when trying to save the data it shows me this error:

Text Formatted Code

E_WARNING(2) - count(): Parameter must be an array or an object that implements Countable @ /home/ramos/VirtualHost/beta/public_html/usersettings.php line 1343
 


Text Formatted Code

1       savepreferences /home/ramos/VirtualHost/beta/public_html/usersettings.php       1577
 


I'm using: MariaDB 10.1.34 and PHP 7.2.10

Any ideas?

Thanks.

D Web Studio - www.d-webstudio.net
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
You didn't saw what version of Geeklog you are using...

I believe this error relates to PHP 7.2 and has been fixed in the upcoming version of Geeklog.

For Geeklog v2.2.0 in usersetting.php around line 1336 replace:

Text Formatted Code
    $TIDS = @array_values($A['topics']);       // array of strings
    $AIDS = @array_values($A['selauthors']);   // array of integers
    $BOXES = @array_values($A['blocks']);       // array of integers
    $ETIDS = @array_values($A['etids']);        // array of strings
    $AETIDS = USER_getAllowedTopics();          // array of strings (fetched, needed to "clean" $TIDS and $ETIDS)


with this:


Text Formatted Code
    $TIDS = array();
    if (isset($A['topics']) && is_array($A['topics'])) {
        $TIDS = array_values($A['topics']);     // array of strings
    }

    $AIDS = array();
    if (isset($A['selauthors']) && is_array($A['selauthors'])) {
        $AIDS = array_values($A['selauthors']); // array of integers
    }

    $BOXES = array();
    if (isset($A['blocks']) && is_array($A['blocks'])) {
        $BOXES = array_values($A['blocks']);    // array of integers
    }

    $ETIDS = array();
    if (isset($A['etids']) && is_array($A['etids'])) {
        $ETIDS = array_values($A['etids']);     // array of strings
    }

    $AETIDS = USER_getAllowedTopics();          // array of strings (fetched, needed to "clean" $TIDS and $ETIDS)


Let us know if it fixes your problem.
One of the Geeklog Core Developers.
 Quote

Status: offline

alb3rt

Forum User
Regular Poster
Registered: 10/30/06
Posts: 71
Location:Mexico City
Thank you very much Laugh, I use gl 2.2.0 and the problem has been solved with your answer.

D Web Studio - www.d-webstudio.net
 Quote

Status: offline

remy

Forum User
Full Member
Registered: 06/09/03
Posts: 162
Location:Rotterdam & Bonn
indescribable
Well, not in my case.
Patched the change in usersettings, and then comes

E_WARNING(2) - sizeof(): Parameter must be an array or an object that implements Countable @ /system/classes/XML/RPC.php line 1724


Though the user data seems to update.
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
I see there have been some more changes to make Geeklog compatible with 7.2

https://github.com/Geeklog-Core/geeklog/commit/1b6b4408660657e28889ed9b7739332cfedba28a<br />
https://github.com/Geeklog-Core/geeklog/commit/24f907a33e0abf978156e7c513267bb4bf7daf47


One of the Geeklog Core Developers.
 Quote

Status: offline

remy

Forum User
Full Member
Registered: 06/09/03
Posts: 162
Location:Rotterdam & Bonn
Well, too bad. I can't run below php 7.1.
When is a clean version expected?
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
Geeklog v2.2.0 runs fine on PHP 7.1 (that is what I use). It is PHP 7.2 that it has problems with. The next release is more than a few months away probably.
One of the Geeklog Core Developers.
 Quote

All times are EDT. The time is now 05:40 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content