Problem/Motivation
Getting this warning sporadically on D9 with PHP 8.1.
Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in ajax_comments_preprocess_status_messages() (line 395 of modules/contrib/ajax_comments/ajax_comments.module).
Steps to reproduce
Edit a node with the following path
/node/1/edit?destination=/404-not-found
In order to trigger a 404 since 404s pages have no route.
Save the node and you will see a status message.
The dblog will register the warning or the next page will show the error as a status message
Comment | File | Size | Author |
---|---|---|---|
#2 | deprecation-issue-3316369-2.patch | 590 bytes | Siddhraj |
|
Issue fork ajax_comments-3316369
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
Siddhraj CreditAttribution: Siddhraj at TO THE NEW commentedHello
passing empty string in the strpos() method resolved this issue.
Instead of passing null in the method strpos() pass an empty string if the variable is null.
Thanks
Comment #3
Kosa Ilma CreditAttribution: Kosa Ilma at Brainsum commentedTested patch with core 9.4.8 and AJAX Comments 8.x-1.0-beta4. Works for me.
Comment #4
Kosa Ilma CreditAttribution: Kosa Ilma at Brainsum commentedComment #7
rodrigoaguileraI proposed a similar solution that I find more readable as MR for easy merging.
Added steps to reproduce to issue summary.
Comment #10
idebr CreditAttribution: idebr at iO commentedCommitted, thanks!