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

The error message is as follows:

• An error message appears after the user changes the login password 

PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /home1/xxxx/public_html/xxx/qa-include/pages/account.php on line 215

 PHP Deprecated:  substr(): Passing null to parameter #1 ($string) of type string is deprecated in /home1/xxxxx/public_html/xxxx/qa-include/db/users.php on line 38

• On Site Notifications - Version 1.4.2 

 whenever user click on the notifications page. error message appear 

PHP Deprecated:  explode(): Passing null to parameter #2 ($string) of type string is deprecated in /home1/xxxxxx/public_html/xxx/qa-include/qa-base.php on line 1575

* My website is currently working with Version 1.8.7

and PHP 8.1

Q2A version: 1.8.7

1 Answer

+4 votes
by
selected by
 
Best answer
I thought I'd fixed the notice when changing passwords, must've missed it. Anyway I've updated the 1.8.8 release to add this in.

On Site Notifications is a third-party plugin so I'd suggest raising an issue to the developer directly (e.g. on their GitHub repo).

Also as a reminder, you shouldn’t have notices set to display on a live site. In your php.ini set display_errors=off
by
Hey @Scott - Can you please share the fix or point to the file to replace?

Thanks.
by
It’s qa-include/pages/account.php
Get it from the zip file on the Q2A website, or this link: https://raw.githubusercontent.com/q2a/question2answer/bugfix/qa-include/pages/account.php
by
qa-include/qa-base.php also needs an update, on line 1575. Should be updated to:
$requestparts = explode('/', $request ?? '');
by
@gold where does that cause a notice? (e.g. which page or action)
by
When clicking/firing the bell of the On-site-notifications plugin.
I've updated all the explodes inside the plugin, but the error was still pointing to that line.

strlen() are also triggering the same error for Q2A Badges. So I've updated them all with the same fix.
by
OK so it's not triggered by Q2A itself? Could you instead update the code in your plugin that calls qa_path, and make sure you pass a string into the function?
e.g. qa_path((string)$request, ...)
by
edited by
Found the line in plugin and pushed a fix to the official repository. Should be fine now.
Disregard my previous comment on "qa-include/qa-base.php" @SaadH
https://github.com/q2apro/q2apro-on-site-notifications
by
Thank you Scott!
by
@gold-developer,
Today I reinstalled and activated the new (onsitenotifications) version after your recent modifications .
There is still an error message that appears after the user answers any question .
The error message is as follows :

PHP Deprecated:  strtr(): Passing null to parameter #1 ($string) of type string is deprecated in /home1/xxxxxx/public_html/xxxx/qa-plugin/q2apro-on-site-notifications-master/q2apro-onsitenotifications-event.php on line 206
by
@SaadH I couldn't replicate this behavior, but patched it with Scott's insight.
https://github.com/q2apro/q2apro-on-site-notifications/pull/41
...