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

 Hi,

My website is currently working with Version 1.8.7

and PHP 8.1

Yesterday when I added a category in the categories section I got an error message in the Cpanel error log , also when I modified anything in the category I got the error message as well .

The error message is as follows:

PHP Deprecated:  strcmp(): Passing null to parameter #2 ($string2) of type string is deprecated in /home1/xxxxxxx/public_html/xxxx/qa-include/pages/admin/admin-categories.php on line 150

Your cooperation is appreciated .

Q2A version: 1.8.7

1 Answer

+1 vote
by
selected by
 
Best answer

You can fix it by changing `$inparentid` to `$inparentid ?? ''` on line 150. Here's how the full line should look:

if (!strcmp($category['parentid'] ?? '', $inparentid ?? '') &&

Looks like I'll have to release a v1.8.8 soon :)

If you find any other warnings/notices in your logs let me know.

by
Thank you Scott,
I will definitely post any feedback on the workflow of the current version 1.8.7 .
by
Thank you. Works for me too.
by
Don't know if I'm missing something, but I had big problems running version 1.8.8 with PHP 8.2. There appears to be a line in qa-include/qa-base.php that says "error_reporting(E_ALL); // be ultra-strict about error checking". This overrides my php.ini production site setting of "E_ALL & ~E_DEPRECATED & ~E_STRICT". The problem this caused me was that there are many instances of code similar to "strlen(@$something)" where it appears that null is not unexpected. However, this generates numerous warnings that passing null to strlen is deprecated - the error log grew to gigabytes and threatened to crash the server. I couldn't see any way to override the setting, apart from hacking the code (which I did).
...