solved PHP fatal error

nattyidub
nattyidub
@admin83512
11 months ago
18 posts
Hi there,

just checked the error log and found the following:

[14-Jan-2024 13:31:48 Europe/Belgrade] PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /var/www/dubwise.info/html/data/cache/jrElastic2/jrSearch_search_results_tpl^e023afa55fec7b06128fc518b67511db7a527701_1.string.php:84 [1]
Stack trace: [2]
#0 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/contrib/smarty4/libs/sysplugins/smarty_template_resource_base.php(123): content_65a3d434d1a209_11120745() [1]
#1 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/contrib/smarty4/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode() [1]
#2 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/contrib/smarty4/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render() [1]
#3 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/contrib/smarty4/libs/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render() [1]
#4 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/contrib/smarty4/libs/sysplugins/smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute() [1]
#5 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/lib/skin.php(903): Smarty_Internal_TemplateBase->display() [1]
#6 /var/www/dubwise.info/html/modules/jrSearch/views/results.php(61): jrCore_parse_template() [1]
#7 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/lib/module.php(314): view_jrSearch_results() [1]
#8 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/router.php(119): jrCore_run_module_view_function() [1]
thrown in /var/www/dubwise.info/html/data/cache/jrElastic2/jrSearch_search_results_tpl^e023afa55fec7b06128fc518b67511db7a527701_1.string.php on line 84 [1]

FYI: it´s the first of it´s kind - just updated to the latest JR version a few days ago.

Regards,
Sven
updated by @admin83512: 05/08/24 03:58:15AM
michael
@michael
11 months ago
7,746 posts
We'll get that fixed. Probably a php 'improvement'. I think count() used to return 0 when given null.

thanks
nattyidub
nattyidub
@admin83512
11 months ago
18 posts
allright, thanks mate.
michael
@michael
11 months ago
7,746 posts
are you using an over-ridden search template:
/var/www/dubwise.info/html/data/cache/jrElastic2/jrSearch_search_results_tpl

is there a file at /skins/jrElastic2//jrSearch_search_results.tpl ?

If you are then look for somewhere in there that has a line like this:
 {if count($results) > 0}
and change it to:
 {if is_array($results) && count($results) > 0}

That change already exists in the base file that I think you have over-ridden. The base file is found at:
/modules/jrSearch/templates/search_results.tpl

It could also be that you have it over-ridden via the templates editor so check at:
ACP -> SKINS -> ELASTIC2 -> TEMPLATES
override.jpg
override.jpg  •  607KB

nattyidub
nattyidub
@admin83512
11 months ago
18 posts
michael:I think you have over-ridden.

Sorry for my late response - have been quite busy. To answer your question: No, I haven´t.
updated by @admin83512: 01/29/24 05:51:22AM
michael
@michael
11 months ago
7,746 posts
ok, i dunno then. If you'd be willing to send some admin level login credentials to support at jamroom dot net along with a link to this thread, I'll login and see if I can spot whats going on.
nattyidub
nattyidub
@admin83512
11 months ago
18 posts
michael:
ok, i dunno then. If you'd be willing to send some admin level login credentials to support at jamroom dot net along with a link to this thread, I'll login and see if I can spot whats going on.

sure, creds are sent to support at jamroom dot net
michael
@michael
11 months ago
7,746 posts
I have logged in, thanks. Im not seeing how to trigger the error. do you know steps to get the error to occur?
nattyidub
nattyidub
@admin83512
11 months ago
18 posts
michael:
I have logged in, thanks. Im not seeing how to trigger the error. do you know steps to get the error to occur?

no. I´m sorry - I´ve just seen the error-message in the error.log

[02-Feb-2024 10:00:34 Europe/Belgrade] PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /var/www/dubwise.info/html/data/cache/jrElastic2/jrSearch_search_results_tpl^e023afa55fec7b06128fc518b67511db7a527701_1.string.php:84 [2]
Stack trace: [4]
#0 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/contrib/smarty4/libs/sysplugins/smarty_template_resource_base.php(123): content_65a3d434d1a209_11120745() [2]
#1 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/contrib/smarty4/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode() [2]
#2 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/contrib/smarty4/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render() [2]
#3 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/contrib/smarty4/libs/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render() [2]
#4 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/contrib/smarty4/libs/sysplugins/smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute() [2]
#5 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/lib/skin.php(903): Smarty_Internal_TemplateBase->display() [2]
#6 /var/www/dubwise.info/html/modules/jrSearch/views/results.php(61): jrCore_parse_template() [2]
#7 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/lib/module.php(314): view_jrSearch_results() [2]
#8 /var/www/dubwise.info/html/modules/jrCore-release-7.0.1/router.php(119): jrCore_run_module_view_function() [2]
  thrown in /var/www/dubwise.info/html/data/cache/jrElastic2/jrSearch_search_results_tpl^e023afa55fec7b06128fc518b67511db7a527701_1.string.php on line 84 [2] 

just checked again and accoording to the error.log the error popped up yesterday the last time. I´d like to note that I haven´t been on my site yesterday/a couple of days.
michael
@michael
11 months ago
7,746 posts
Ok, got it.

The steps to reproduce are:
* click the SEARCH in the header link.
* the modal opens. Enter nothing in the modal, immediately click SEARCH.

Result
Error is triggered in the Error Log.
2024-02-06_11-40.jpg

michael
@michael
11 months ago
7,746 posts
The error should no longer fire. The template in your jrSearch didnt have the latest adjustments. The next version of search will fix it for everyone. Until then I've adjusted your template here. (screenshot)

Try that.
2024-02-06_14-20.jpg

nattyidub
nattyidub
@admin83512
11 months ago
18 posts
Great news, thanks mate.
michael
@michael
11 months ago
7,746 posts
you can delete that account you made for me, or change its permissions down to standard user so if anything goes weird you know its not me. ;)
nattyidub
nattyidub
@admin83512
11 months ago
18 posts
well. somehow i like this "if something´s not working it´s michael´s fault"-thing. :D
yeah, gonna delete the account right now.

finally i´ve found the "Profile Active"-checkbox again! *lol* so i´ve set the account inactive - just in case... ;)
updated by @admin83512: 02/07/24 05:14:22AM
michael
@michael
11 months ago
7,746 posts
cool thanks. Just give me access when you know im there. No need to give your plumber a key to the house just in case he wants to fix something at 3am.

Tags