Commit e0533d2e by pupi1985

Fix #882 - Error thrown on PHP 8 when attempting to count() null values

parent c478a0dd
...@@ -31,7 +31,7 @@ require_once QA_INCLUDE_DIR . 'app/q-list.php'; ...@@ -31,7 +31,7 @@ require_once QA_INCLUDE_DIR . 'app/q-list.php';
// Get list of hottest questions, allow per-category if QA_ALLOW_UNINDEXED_QUERIES set in qa-config.php // Get list of hottest questions, allow per-category if QA_ALLOW_UNINDEXED_QUERIES set in qa-config.php
$categoryslugs = QA_ALLOW_UNINDEXED_QUERIES ? qa_request_parts(1) : null; $categoryslugs = QA_ALLOW_UNINDEXED_QUERIES ? qa_request_parts(1) : null;
$countslugs = @count($categoryslugs); $countslugs = $categoryslugs === null ? null : count($categoryslugs);
$start = qa_get_start(); $start = qa_get_start();
$userid = qa_get_logged_in_userid(); $userid = qa_get_logged_in_userid();
......
...@@ -36,7 +36,7 @@ if (QA_ALLOW_UNINDEXED_QUERIES) ...@@ -36,7 +36,7 @@ if (QA_ALLOW_UNINDEXED_QUERIES)
else else
$categoryslugs = null; $categoryslugs = null;
$countslugs = @count($categoryslugs); $countslugs = $categoryslugs === null ? null : count($categoryslugs);
$by = qa_get('by'); $by = qa_get('by');
$start = qa_get_start(); $start = qa_get_start();
$userid = qa_get_logged_in_userid(); $userid = qa_get_logged_in_userid();
......
...@@ -74,7 +74,7 @@ function qa_feed_not_found() ...@@ -74,7 +74,7 @@ function qa_feed_not_found()
function qa_feed_load_ifcategory($categoryslugs, $allkey, $catkey, &$title, function qa_feed_load_ifcategory($categoryslugs, $allkey, $catkey, &$title,
$questionselectspec1 = null, $questionselectspec2 = null, $questionselectspec3 = null, $questionselectspec4 = null) $questionselectspec1 = null, $questionselectspec2 = null, $questionselectspec3 = null, $questionselectspec4 = null)
{ {
$countslugs = @count($categoryslugs); $countslugs = $categoryslugs === null ? null : count($categoryslugs);
list($questions1, $questions2, $questions3, $questions4, $categories, $categoryid) = qa_db_select_with_pending( list($questions1, $questions2, $questions3, $questions4, $categories, $categoryid) = qa_db_select_with_pending(
$questionselectspec1, $questionselectspec1,
...@@ -165,7 +165,7 @@ switch ($feedtype) { ...@@ -165,7 +165,7 @@ switch ($feedtype) {
break; break;
} }
$countslugs = @count($categoryslugs); $countslugs = $categoryslugs === null ? null : count($categoryslugs);
if (!isset($feedoption)) if (!isset($feedoption))
qa_feed_not_found(); qa_feed_not_found();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment