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

Hello,

I'm currently setting up Q2A for my organization. Until now, everything was working correctly except for 1 error that I got when I tried to add new category. The site is new so I don't have any category yet. 

I got the error whenever I click the "Add Category" button.

Here is the error message:

Fatal error: Uncaught ValueError: max(): Argument #1 ($value) must contain at least one element in C:\xampp\htdocs\test\qa-include\pages\admin\admin-categories.php:483 Stack trace: #0 C:\xampp\htdocs\test\qa-include\pages\admin\admin-categories.php(483): max(Array) #1 C:\xampp\htdocs\test\qa-include\app\page.php(183): require('C:\\xampp\\htdocs...') #2 C:\xampp\htdocs\test\qa-include\qa-page.php(47): qa_get_request_content() #3 C:\xampp\htdocs\test\qa-include\qa-index.php(188): require('C:\\xampp\\htdocs...') #4 C:\xampp\htdocs\test\index.php(27): require('C:\\xampp\\htdocs...') #5 {main} thrown in C:\xampp\htdocs\test\qa-include\pages\admin\admin-categories.php on line 483

What should I do to fix this?

Q2A version: 1.8.6

1 Answer

+1 vote
by
selected by
 
Best answer

That's an error happening in the development branch of Q2A 1.9 when using PHP 8. I've provided a fix for that here: https://github.com/q2a/question2answer/pull/911

My advice: don't use the dev branch. Use the master branch, instead. Or download Q2A from the official release link: https://github.com/q2a/question2answer/releases/download/v1.8.6/question2answer-1.8.6.zip

by
The version I'm using was downloaded from the main site. It's version 1.8.6. Is that different from the master branch on GitHub?
by
My bad, it is not necessarily the dev branch. It might be the master branch but still under PHP 8. In that case, you will have to merge my pull request by modifying the files I suggested
by
Thank you for clarifying. I tried the fix and it works. Thanks again.
...