Updated: Comment #68
Problem/Motivation
A fatal PHP error occurs when publishing a comment and a "Unpublish comments with keywords" action is enabled.PHP Fatal error: Cannot use object of type stdClass as array in /.../includes/common.inc on line 5672
This is a major issue as it would cause blank comments to be saved.
Steps to reproduce issue:
1. Create some node.
2. Enable Trigger module.
3. Create "Unpublish comments with keywords" action. Set 2 or more keywords. for example "http://, www., mailto:"
4. Set action to trigger on "New comment saved" event.
5. Type a comment on a node and click "preview"
6. Submit comment.
7. WSOD. Comment saved without body.
The issue is traced to the comments module in /core/modules/comment/comment.module, inside the comment_unpublish_by_keyword_action function.
This function is making a call for drupal_render($comment) but $comments is a comment object and not render array.
Proposed resolution
Proposed solution is to get a renderable array of the comment and not the comment object, using the comment_view function.
For Drupal 8 there is a patch in #56
https://drupal.org/files/1461732-56.patch
Remaining tasks
Needs to be backported for Drupal 7.
User interface changes
None
API changes
None
Related Issues
Not sure