count(): Argument #1 ($value) must be of type Countable|array, null given - Forum | JoomShaper
Solved SP Page Builder

count(): Argument #1 ($value) must be of type Countable|array, null given

Asked by Geoffrey Smith 4 years ago Last activity 2 years ago

Hi I have created the production site in the test environment and been able to set the ph version to 8. When I go to the front page of the test site I get the following error: count(): Argument #1 ($value) must be of type Countable|array, null given

The error_log contains the following line:

[30-Aug-2022 16:42:36 UTC] PHP Warning: Undefined property: stdClass::$use_border in /home/geoffre3/public_html/02-Test/GSTst/components/com_sppagebuilder/layouts/column/css.php on line 56
[30-Aug-2022 16:42:36 UTC] PHP Warning: Attempt to read property "social_url" on array in /home/geoffre3/public_html/02-Test/GSTst/components/com_sppagebuilder/addons/team_carousel/site.php on line 94
[30-Aug-2022 16:42:36 UTC] PHP Warning: Attempt to read property "title" on array in /home/geoffre3/public_html/02-Test/GSTst/components/com_sppagebuilder/addons/team_carousel/site.php on line 94
[30-Aug-2022 16:42:36 UTC] PHP Warning: Attempt to read property "social_icon" on array in /home/geoffre3/public_html/02-Test/GSTst/components/com_sppagebuilder/addons/team_carousel/site.php on line 94
[30-Aug-2022 16:42:36 UTC] PHP Warning: Attempt to read property "title" on array in /home/geoffre3/public_html/02-Test/GSTst/components/com_sppagebuilder/addons/team_carousel/site.php on line 94
[30-Aug-2022 16:42:36 UTC] PHP Warning: Undefined property: stdClass::$no_gutter in /home/geoffre3/public_html/02-Test/GSTst/components/com_sppagebuilder/layouts/row/css.php on line 646
[30-Aug-2022 16:42:36 UTC] PHP Warning: Undefined property: stdClass::$use_border in /home/geoffre3/public_html/02-Test/GSTst/components/com_sppagebuilder/layouts/column/css.php on line 56
[30-Aug-2022 16:42:36 UTC] PHP Warning: Undefined variable $twofactormethods in /home/geoffre3/public_html/02-Test/GSTst/templates/edulif/html/mod_login/default.php on line 70

Can you help?

Accepted answer

Marked as the solution
Toufiq Senior Staff

Solved by adding this line of code.

templates/edulif/html/mod_login/default.php

line on 18

use Joomla\CMS\Helper\AuthenticationHelper;

56 more replies

AJones

I've got the same issue using Shaper Estate.....I switched back to PHP 7.4 and it was fine.

But obviously that's not a solution.....does anybody have any idea on this?

David Soens

I also have the same issue with a Joomla 4 site running Helix Ultimate 2.0.11. I found if I switch templates to Cassiopeia to error goes away.

AJones

I found the solution......the login module.

Once I disabled it the site loaded fine on PHP 8.1

Jan Huszarik

Well thank AJones. Same problem as you. I turned off the Login Module and the problem is gone. I am using PHP 8.1

AJones

Glad it worked for you Jan!

David Soens

Thanks, I tried your fix AJones, unfortunately it didn't get rid of the error. Also, the link to your ticket said: You are not authorized to see this question.

‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
4 years ago · edited

Sorry missread the template name. :)
The edulif template is helix ultimate and not helix 3.

Ignore my reply. :)

Others have also reported, that the Ultimate Tempaltes are not PHP 8 ready, but support Joomla 4.

‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
4 years ago · edited

I have installed a fresh version of joomla 4.2.1 with edulif template and PHP8.0.
I could locate multiple problems.

First Problem:

/joomla4/templates/edulif/error.php:71
Object of class stdClass could not be converted to string

echo $theme_url . '/css/presets/' . $preset . '.css';

The variable "$preset" is an object and not a string.

object(stdClass)#737 (1) { ["presets"]=> string(7) "preset1" }

To solve this problem, the parameter in line 59 must be changed.
Checked the current version of helix ultimate at github.
-> https://github.com/JoomShaper/helix-ultimate/blob/master/templates/shaper_helixultimate/error.php#L59

It should look like this:

            $preset = $params->get('preset', json_encode(['preset' => 'preset1']));

            if (!empty($preset) && is_string($preset))
            {
                $preset = json_decode($preset);
            }

            if (!empty($preset->preset)) {
                $preset = $preset->preset;
            }

Second Problem:

JROOT/templates/edulif/html/mod_login/default.php:70
count(): Argument #1 ($value) must be of type Countable|array, null given

if (count($twofactormethods) > 1) : 

The problem here is a missing entry.

$twofactormethods   = AuthenticationHelper::getTwoFactorMethods();

Do not forget to add a use statement at the beginning of the file or you will get a error-message.

use Joomla\CMS\Helper\AuthenticationHelper;

The variable "twofactormethods" is not set at all and as a result count fails.
If you add the mentioned line in line 22, the login module will work again.

It should then look like this after you have added the line.

$twofactormethods   = AuthenticationHelper::getTwoFactorMethods();
HTMLHelper::_('behavior.keepalive');
HTMLHelper::_('bootstrap.tooltip');
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎

One more addition.
The problem with the error.php and the login module affects all currently offered templates based on Helix Ultimate.

Even Maestro, the newest template, has these errors!
Only that with Maestro it comes directly from the Helix Ultimate Framework.

count(): Argument #1 ($value) must be of type Countable|array, null given
JROOT/plugins/system/helixultimate/overrides/mod_login/default.php:54

Log in to reply.