Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When a reply is made that includes a valid thread ID in which the author is not permitted to participate (for whatever reason), privatemsg_thread_load() will return FALSE, but there is no check that the returned value is valid, and PHP notices similar to these are reported:
- Warning: end() expects parameter 1 to be array, null given in privatemsg_reply() (line #### of .../sites/all/modules/contrib/privatemsg/privatemsg.module).
- Notice: Trying to get property of non-object in privatemsg_reply() (line #### of .../sites/all/modules/contrib/privatemsg/privatemsg.module).
Proposed resolution
Add a check for a valid return value and report an appropriate error message.
Remaining tasks
Fix the issueCreate a patch- Review the patch
Commit the patch
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#3 | check-thread-before-using_2884532_3.patch | 1.23 KB | oadaeh |
#2 | check-thread-before-using_2884532_2.patch | 1.14 KB | oadaeh |
Comments
Comment #2
oadaeh CreditAttribution: oadaeh at Hook 42 commentedPatch attached that fixes the problem.
Comment #3
oadaeh CreditAttribution: oadaeh at Hook 42 commentedI updated the patch to remove some extra spaces. (There's a lot more I could change, but I'm just staying focused on the code related to the problem.) No other changes were made.
Comment #5
oadaeh CreditAttribution: oadaeh at Hook 42 commentedPatch committed. Closing ticket.