Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
231 views
in Q2A Core by

hello all friends

my website has error as in below. Could you please help me?

PHP version: 8.0.2
MySQL version: 10.1.48-MariaDB-0+deb9u1

mod_fcgid: stderr: PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in /www/q2a/qa-include/pages/unanswered.php:39, referer: https://mysite

[Fri Mar 12 23:53:19.326910 2021] [fcgid:warn] [pid 23998] [client xx.xxx.xx.xxx:53609] mod_fcgid: stderr: Stack trace:, referer: https://mysite

[Fri Mar 12 23:53:19.326918 2021] [fcgid:warn] [pid 23998] [client xx.xxx.xx.xxx:53609] mod_fcgid: stderr: #0 /www/q2a/qa-include/app/page.php(187): require(), referer: https://mysite

[Fri Mar 12 23:53:19.326925 2021] [fcgid:warn] [pid 23998] [client xx.xxx.xx.xxx:53609] mod_fcgid: stderr: #1 /www/q2a/qa-include/qa-base.php(752): qa_get_request_content(), referer: https://mysite

[Fri Mar 12 23:53:19.326954 2021] [fcgid:warn] [pid 23998] [client xx.xxx.xx.xxx:53609] mod_fcgid: stderr: #2 /www/q2a/qa-include/qa-base.php(814) : eval()'d code(1): qa_call('qa_get_request_...', Array), referer: https://mysite

[Fri Mar 12 23:53:19.326963 2021] [fcgid:warn] [pid 23998] [client xx.xxx.xx.xxx:53609] mod_fcgid: stderr: #3 /www/q2a/qa-include/qa-base.php(720) : eval()'d code(70): qa_get_request_content_base(), referer: https://mysite

[Fri Mar 12 23:53:19.326970 2021] [fcgid:warn] [pid 23998] [client xx.xxx.xx.xxx:53609] mod_fcgid: stderr: #4 /www/q2a/qa-include/qa-base.php(720) : eval()'d code(11): qa_get_request_content_override_1_in_overrides_php(), referer: https://mysite

[Fri Mar 12 23:53:19.326976 2021] [fcgid:warn] [pid 23998] [client xx.xxx.xx.xxx:53609] mod_fcgid: stderr: #5 /www/q2a/qa-include/qa-base.php(752): qa_get_request_content_override_2_in_qa_wiki_overrides_php(), referer: https://mysite

[Fri Mar 12 23:53:19.326982 2021] [fcgid:warn] [pid 23998] [client xx.xxx.xx.xxx:53609] mod_fcgid: stderr: #6 /www/q2a/qa-include/qa-base.php(817): qa_call('qa_get_request_...', Array), referer: https://mysite

[Fri Mar 12 23:53:19.326987 2021] [fcgid:warn] [pid 23998] [client xx.xxx.xx.xxx:53609] mod_fcgid: stderr: #7 /www/q2a/qa-include/app/page.php(174): qa_call_override('qa_get_request_...', Array), referer: https://mysite

[Fri Mar 12 23:53:19.326992 2021] [fcgid:warn] [pid 23998] [client xx.xxx.xx.xxx:53609] mod_fcgid: stderr: #8 /www/q2a/qa-include/qa-page.php(47): qa_get_request_content(), referer: https://mysite

[Fri Mar 12 23:53:19.326996 2021] [fcgid:warn] [pid 23998] [client xx.xxx.xx.xxx:53609] mod_fcgid: stderr: #9 /www/q2a/qa-include/qa-index.php(188): require('/var/customers/...'), referer: https://mysite

[Fri Mar 12 23:53:19.327001 2021] [fcgid:warn] [pid 23998] [client xx.xxx.xx.xxx:53609] mod_fcgid: stderr: #10 /www/q2a/index.php(27): require('/var/customers/...'), referer: https://mysite

Q2A version: 1.8.5

1 Answer

0 votes
by
edited by

Hello @vijaysumit,

Please replace this line of code:

$countslugs = @count($categoryslugs);

with this one:

$countslugs = $categoryslugs ? count($categoryslugs) : 0;

in line 138 at qa-include/pages/unanswered.php

Since PHP 8 is been used, these other fixes are also recommended:

If you enable the reCAPTCHA plugin, then this error might be thrown:

mod_fcgid: stderr: PHP Fatal error:  Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /www/qa-include/app/captcha.php:98

which can be fixed by replacing:

'error' => @array_key_exists('captcha', $errors) ? qa_lang_html('misc/captcha_error') : null,

with

'error' => isset($errors['captcha']) ? qa_lang_html('misc/captcha_error') : null,

in line 98 at qa-include/app/captcha.php

I hope it helps.

by
thanks :) it works

but i have another problem with registration page

mod_fcgid: stderr: PHP Fatal error:  Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /www/qa-include/app/captcha.php:98
by
@vijaysumit, Thanks for reporting this issue. Please take a look at my latest edit.
by
edited by
Thank you :) Still errors exists :((

--------------------
[Sun Mar 14 18:23:42.371763 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: PHP Fatal error:  Uncaught Error: Undefined constant "\x91captcha\x92" in /www/qa-include/app/captcha.php:98, referer: http://mypage
[Sun Mar 14 18:23:42.371921 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: Stack trace:, referer: http://mypage
[Sun Mar 14 18:23:42.371931 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: #0 /www/qa-include/pages/register.php(219): qa_set_up_captcha_field(Array, Array, NULL), referer: http://mypage
[Sun Mar 14 18:23:42.371937 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: #1 /www/qa-include/app/page.php(183): require('/var/customers/...'), referer: http://mypage
[Sun Mar 14 18:23:42.371943 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: #2 /www/qa-include/qa-base.php(752): qa_get_request_content(), referer: http://mypage
[Sun Mar 14 18:23:42.371950 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: #3 /www/qa-include/qa-base.php(814) : eval()'d code(1): qa_call('qa_get_request_...', Array), referer: http://mypage
[Sun Mar 14 18:23:42.371956 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: #4 /www/qa-include/qa-base.php(720) : eval()'d code(70): qa_get_request_content_base(), referer: http://mypage
[Sun Mar 14 18:23:42.371962 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: #5 /www/qa-include/qa-base.php(720) : eval()'d code(11): qa_get_request_content_override_1_in_overrides_php(), referer: http://mypage
[Sun Mar 14 18:23:42.371968 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: #6 /www/qa-include/qa-base.php(752): qa_get_request_content_override_2_in_qa_wiki_overrides_php(), referer: http://mypage
[Sun Mar 14 18:23:42.371975 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: #7 /www/qa-include/qa-base.php(817): qa_call('qa_get_request_...', Array), referer: http://mypage
[Sun Mar 14 18:23:42.371981 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: #8 /www/qa-include/app/page.php(174): qa_call_override('qa_get_request_...', Array), referer: http://mypage
[Sun Mar 14 18:23:42.371987 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: #9 /www/qa-include/qa-page.php(47): qa_get_request_content(), referer: http://mypage
[Sun Mar 14 18:23:42.371993 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: #10 /www/qa-include/qa-index.php(188): require('/var/customers/...'), referer: http://mypage
[Sun Mar 14 18:23:42.371999 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: #11 /www/index.php(27): require('/var/customers/...'), referer: http://mypage
[Sun Mar 14 18:23:42.372005 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr: #12 {main}, referer: http://mypage
[Sun Mar 14 18:23:42.372011 2021] [fcgid:warn] [pid 19263] [client xxx.xxx.x.xx:60149] mod_fcgid: stderr:   thrown in /www/qa-include/app/captcha.php on line 98, referer: http://mypage
by
I think there’s one line of error log missing at the beginning, it describes where the actual error occurred. Could you please edit your comment and add it so that I can check it?
by
edited, thanks
by
+1
Done, I’ve edited the answer. Please, try to reapply the reCAPTCHA change. This error was thrown because I used the wrong quotation marks ([‘’] instead of [''])
...