Count(): Argument #1 ($value) Must Be Of Type Countable|array, Null Given - Question | JoomShaper

Count(): Argument #1 ($value) Must Be Of Type Countable|array, Null Given

Geoffrey Smith

Geoffrey Smith

SP Page Builder 1 year 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?

1
58 Answers
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #91220

Solved by adding this line of code.

templates/edulif/html/mod_login/default.php

line on 18

use Joomla\CMS\Helper\AuthenticationHelper;

0
A
AJones
Accepted Answer
1 year ago #82422

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?

0
DS
David Soens
Accepted Answer
1 year ago #82428

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.

0
A
AJones
Accepted Answer
1 year ago #82429

I've got a ticket going here David......and support are responding:

https://www.joomshaper.com/forum/question/17273

0
A
AJones
Accepted Answer
1 year ago #82450

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

Once I disabled it the site loaded fine on PHP 8.1

1
JH
Jan Huszarik
Accepted Answer
1 year ago #82474

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

0
A
AJones
Accepted Answer
1 year ago #82475

Glad it worked for you Jan!

0
DS
David Soens
Accepted Answer
1 year ago #82582

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.

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #82631

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.

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #82647

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');
0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #82648

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

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #82863

Hi there,

Thanks for contacting us. Please accept my apologies. I will share this issue with our developer team. I hope they will check & if they find out the real issue. Then they will fix it soon.

-Thanks

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #82950

Hello Toufiq,

thank you for forwarding it.
Please let us know what the real problem was once the developers get back to you.

Until then, the template can be used with the above mentioned adjustments. An update by the developers will subsequently overwrite these changes and replace them with those of Joomshaper.

@others If you discover more issues with php8, let me know.
I will help you until my licence experies in 60 days.

With kind regards

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #83052

Already i have added this issue on working board. I will inform when our developer team assigned to work. Thanks

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #83053

I you discover more issues with php8, let me know.

You can share your investigation.

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #83167

Small update on this.

The Problem with the mod_login of maestro is solved with installing the update of helix ultimate 2.0.11.

Joomshaper solved the Problem by adding the following line above the count query.

if(version_compare(JVERSION, '4.2.0', '<')) :

This can also be transferred to the Edulif and other helix ultimate templates.
It should look like this, after adding the line.
I would still recommend to use my patch, because it is much easier and causes less problems with the integration.

The new Template "Live Sports" also has the fixed error.php.

Good to see that the problems are now fixed as of the latest tempalte "Live Sports".

BUT, all previous templates still need to be adjusted by hand until an update comes for them, as they still bring their own override for login and have the buggy error.php.

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #83225

Can you produce the issue on this URL?

http://helix-framework.org/administrator/

admin

qazwsxedc@#123

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #83230

@Toufiq I have reproduced the Error of mod_login on your page.
At first it, would not happen, because you where using the shared sessions.
Without shared sessions, the problem can be triggered.

The Problem with the error.php will only be visible if there was no other Helix Ultimate templated installed.
This is because of the preset-parameter which will then not be defined and the default value will be used.

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

The default value includes the typo which leads to the error. "presets instead of preset"

I hope this helps.

http://helix-framework.org/

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #83231

Right now i need the page builder issue. Which you have shared before. Thanks

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #83237

Hello Toufiq,

sorry to disappoint you, I didn't report any problem with PageBuilder in this post.
Neither did any of the other users.

Geoffrey Smith accidentally opened in the wrong category.
It is a problem with the template.
Based on all the reports from his error.log, I can understand why he opened the post in that category.

With kind regards

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #83240

Thank you for your valuable time to investigate. We will fix it next update of Helix.

0
Marc Dechèvre
Marc Dechèvre
Accepted Answer
1 year ago #87633

Some additional feedback on that issue about count(): Argument #1 ($value) must be of type Countable|array, string given

Without warning, the hosting company changed the PHP version to 8.0... and then the site crashed with the above-mentioned error.

After some tests, I discovered that the issue was the file /templates/shaper_varsita/features/account.php which uses if(count($result)) {

If I temporarily disable this line then I have a workaround. But what is the real fix please for this Count on a Array pls ?

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #88046

Hello Marc,

unfortunately I have to inform you that the tempalte you are using is based on Helix3 and has been released for Joomla3 only.
Here I assume that in the next few months no update will come, because not only PHP8, but also Joomla4 support is needed.

But since I do not belong to the support, I can only speculate here.

For Helix3 templates that already have Joomla4 support, you can use the patches from me on Github.
https://github.com/JoomShaper/Helix3/pull/112

It would probably be better to switch to another template here.
If there should be no concrete ETAs for an update from the support.
e.g.: first quarter 2023

0
Geoffrey Smith
Geoffrey Smith
Accepted Answer
1 year ago #90861

When will Joomshaper issue a fix for this problem? It must be affecting all templates running under php 8

0
Geoffrey Smith
Geoffrey Smith
Accepted Answer
1 year ago #90909

@Jens

I tried your fix for edulif mentioned above and it gives me the following error now:

Error: 0 0 Class "AuthenticationHelper" not found

Any ideas?

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #91060

@Geoffrey Smith Will you please provide me the Joomla administrator access to check the issue?

0
JH
Jan Huszarik
Accepted Answer
1 year ago #91061

@Toufiq I'm dealing with the same problem. Can you help me too? please

0
Geoffrey Smith
Geoffrey Smith
Accepted Answer
1 year ago #91079

Here ya go

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #91146

@Geoffrey Smith Will you please give the database access?

At first i have to solve this issues.

https://prnt.sc/_YQPg_hYMklo

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #91149

Hello @Geoffrey,

sorry for the late reply.
would you please provide the stacktrace of the error message?
You can do this via the debug mode.

Since my license expires on 3.11, I can only help until then.
After that only Github remains.

However, Toufiq may also be able to eliminate the problem.

0
Geoffrey Smith
Geoffrey Smith
Accepted Answer
1 year ago #91198

@Toufiq I need an email address so the host site can send you an invite...

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #91202

check the hidden content

0
Geoffrey Smith
Geoffrey Smith
Accepted Answer
1 year ago #91212

@Toufiq check the account email

0
Geoffrey Smith
Geoffrey Smith
Accepted Answer
1 year ago #91213

Hi @Jens here is the stacktrace: https://prnt.sc/323XeZG7lpng

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #91253

@Toufiq Thank you for this help, I missed this Information in my post.

@all I have updated my post to fix the problem and keep others from it.

https://www.joomshaper.com/forum/question/17241#qa-answer-82647

0
Geoffrey Smith
Geoffrey Smith
Accepted Answer
1 year ago #91508

@Jens I would have thought the the Joomshaper team would be happy to extend your licence considering all the work you have been doing here. I for one have appreciated your willingness to go that one step extra in helping to resolve this issue especially in light of all the angst we have seen around the pb4 release.

Thank you

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #91595

@jens Please share your account email address.

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #91964

@Geoffrey Smith
Joomshaper has extended the sppb license, but unfortunately with this I can't download the templates to help with problems.

Or to install and test the templates locally.

Therefore also a thank you to Joomshaper for extending, even if I can't help with problems with templates with it.

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #92149

@Jens which template do you need?

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #92176

@Toufiq It depends on the customer who has a problem with a template.
Therefore, it is not possible to make a blanket statement about which template is needed.
For example, this ticket was about the template "edulif and estate".
Another customer then joined and has a problem with "varsita".
In this ticket, I currently do not need any templates, because I already have them.
Eventually I will need Megadeal II, because here for two months virtually nothing has happened.
-> https://www.joomshaper.com/forum/question/17303
or also this ticket
-> https://www.joomshaper.com/forum/question/17824
or here
-> https://www.joomshaper.com/forum/question/18889

If possible, I would get back to you as soon as I need a template.

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #92180

Please check the hidden content.

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #92492

@Toufiq
Thank you for your efforts, but the ticket belongs to Geoffrey and you have now provided him with the stuff in the Hidden Content. :)
I can not see this because I am not the creator of this thread. :)
Only Geoffrey can see the hidden content ;)

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #92498

@jens extended your template license. Thanks

0
KH
Khalizan Bin Mohamed Halid
Accepted Answer
1 year ago #94124

Amhaving this problem too and now the website is not running and my clients are fuming as they are losing business - http://artshowgallery.com

PHP Version 8.0.25 Web Server Apache WebServer to PHP Interface cgi-fcgi Joomla! Version Joomla! 4.2.5 Stable [ Uaminifu ] 8-November-2022 15:00 GMT User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.52

Pagebuilder 4.0.6 backend is ok

com_login is disabled

Shaper_helixultimate Details and Files 2.0.11

Tz_lefala Details and Files 1.0.1

Thanks

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #94171

Greetings, please check the domain you have provided.
The domain only returns an error message that it is not known to the DNS.

The free Helix Ultimate in combination with the SPPB 4.0.6 should work with PHP 8.0.
I suspect there is a problem with one of the other plugins.
Please enable debug mode and copy the stacktrace of the error message.

In most cases, this will give more precise information about where the problem was triggered.

Have a great week.

0
AJ
Adhemar Jr
Accepted Answer
1 year ago #102628

Did you solve this Issue? For PHP 8.0 I found a simple way to solve maybe works for you too. Go to templates/YOURTEMPLATE/html/mod_login/default.php search

if (count($twofactormethods) > 1) : 

change to

if (count((array)$twofactormethods) > 1) : 

This system recognizes as an array.

2
W
wade
Accepted Answer
4 months ago #140135

This one solved my issue using the Manufacturer template. Unknown if it borks something else but it fixed the error in this thread as well as the other one I was getting about a bad security token. Thanks.

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #102645

@Adhemar

Thanks for your contribution to solving the problem.
I listed another way to solve it in my post from 4 months ago.
Joomshaper has solved the problem differently in the current version. They have built in a query for the Joomla version.

https://github.com/JoomShaper/helix-ultimate/blob/2.0.11/plugins/system/helixultimate/overrides/mod_login/default.php#L53

if(version_compare(JVERSION, '4.2.0', '<'))
0
Geoffrey Smith
Geoffrey Smith
Accepted Answer
1 year ago #102649

@Jens

Seems like a limited and troublesome way to deal with the issue! Quick fixes and hard coding values will always come back to bite you in the butt! I know as I've had over 30 years experience as an Oracle RDBMS DBA. Been there done that got the t shirt and the burn marks to prove it!

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
1 year ago #102658

@Geoffrey you are completly right, but without a update by joomshaper, this is at the moment the only way to deal with it.
If you hoster forces you to use php 8.x you are forced to do this kind of fixes or abandon the joomshaper template and get a new one which will be compatible with php 8.x.

The fixes I provide are always temporary fixes until joomshaper updates there tamplates and the fix will be overridden.

But, even if there is a fully functional tested patch, the joomshaper devs do not use them.
In return the customers of joomshaper are comming back and reporting errors.

https://www.joomshaper.com/forum/question/21263#qa-answer-101210

1
BI
Bambang Ismono
Accepted Answer
1 year ago #108499

i have the same problem with any user above, but there is no fix code from joomshaper. the issue is still there, change to ver8.0 maked website crash.

thanks @jens for the detail about this issue

0
Geoffrey Smith
Geoffrey Smith
Accepted Answer
1 year ago #108548

@Bambang Ismono the fix is in the early part of this thread if you have not lready found it.

0
AJ
Adhemar Jr
Accepted Answer
1 year ago #108690

@Bambang Ismono I'll send again the procedure.

Go to templates/YOURTEMPLATE/html/mod_login/default.php search

if (count($twofactormethods) > 1) : 

change to

if (count((array)$twofactormethods) > 1) : 

This system recognizes as an array.

0
BI
Bambang Ismono
Accepted Answer
1 year ago #110117

and i hve this error

syntax error, unexpected '<', expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF)

i chnge to php 7.4 and this error still there

==== i fixed it with com_login disable d

0
AJ
Adhemar Jr
Accepted Answer
1 year ago #110466

@Bambang Ismono if you work with PHP 8.0 the procedure is the procedure above. If you change to PHP 7.4 all system needs to work with 7.4 in other words, changing the PHP you have to code in PHP version that you choose. Choose a version and find the error, I recommend PHP 8.0 due safety and security.

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #110853

@Bambang Ismono and @Adhemar Jr Will you please provide me the Joomla administrator access to check the issue?

0
AJ
Adhemar Jr
Accepted Answer
1 year ago #110939

@Toufiq the Issue has been solved the administrator panel has not involved in the Issue. Just the PHP version and the code. But it has been solved until the version PHP 8.

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #111116

@Adhemar Jr If you need assistance from us, please don't hesitate to contact us. Thanks

0