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.
I found two bugs in comment_publish_action() and comment_unpublish_action() function in the comment.module as you can see below.
function comment_publish_action($comment, $context = array()) {
// $subject = db_query('SELECT subject FROM {comment} WHERE cid = :cid', array(':cid', $cid))->fetchField(); // NG
$subject = db_query('SELECT subject FROM {comment} WHERE cid = :cid', array(':cid' => $cid))->fetchField();
function comment_unpublish_action($comment, $context = array()) {
// $subject = db_query('SELECT subject FROM {comment} WHERE cid = :cid', array(':cid', $cid))->fetchField(); // NG
$subject = db_query('SELECT subject FROM {comment} WHERE cid = :cid', array(':cid' => $cid))->fetchField();
Comment | File | Size | Author |
---|---|---|---|
#3 | 974072-comment-actions-broken.patch | 4.95 KB | Damien Tournoud |
#2 | 974072-comment-actions-broken.patch | 4.26 KB | Damien Tournoud |
Comments
Comment #1
pixture CreditAttribution: pixture commentedStill not fixed with RC1.
Comment #2
Damien Tournoud CreditAttribution: Damien Tournoud commentedActually, both publish and unpublish actions are completely broken. Raising to critical.
Comment #3
Damien Tournoud CreditAttribution: Damien Tournoud commentedAdded proper documentation blocks.
Comment #4
carlos8f CreditAttribution: carlos8f commentedComment #5
carlos8f CreditAttribution: carlos8f commentedLooks like a simple DBTNG muckup, except:
Can you explain the reasoning behind this?
BTW, another test that could use #652394: Aggressive watchdog message assertion, which is unfortunately D8 now.
Comment #6
catch$comment->comment can never exist - it's now a field. Subject should be set even if it's empty iirc. Looks good to me.
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commentedOh come on. It is just a bug. But I'll meet you half way. and RTBC.
Comment #8
Damien Tournoud CreditAttribution: Damien Tournoud commentedThose two actions don't work. At all. Period. That's the definition of a critical bug.
Comment #9
webchickCommitted to HEAD. Thanks!
Comment #11
grugnir CreditAttribution: grugnir commentedNice patch. So just what does one DO with it?? I've been searching for hours and have found NOTHING in plain English (or any other human language) that is of any practical use to an average person, in any of the literally dozens of threads I've waded through. I'm not dumb as a box of rocks, but neither am I a complete geek.
Surely there must be SOME simple (or somewhat simple, at least) method for applying patches?????? Even WordPress has that one pegged, for cryin' out loud...
Comment #12
carlos8f CreditAttribution: carlos8f commented@grugnir, the patch is already part of D7 (issue status "fixed" back in December), so you don't have to do anything with it :) But if you're running 7.0 stable (or newer) and are still noticing this bug, please speak up.
Comment #13
grugnir CreditAttribution: grugnir commentedOkay, here's my pickle:
I created an action, "Unpublish comment containing keyword(s)," because I was getting spammed up the pooper. I assigned the action to the "When either saving a new comment or updating an existing comment" trigger. So when I try to submit a comment, it barfs up "Fatal error: Cannot use object of type stdClass as array in blahblahblah/includes/common.inc on line 5564" at me. Logged in or not makes no difference.
I upgraded from 7.0 to 7.2, thinking that would unbugger it, but no dice. Unassign the action from the trigger, and everything's jolly. I'll leave the trigger enabled for now.
The crunchy stuff:
Site: http://www.gunownersresource.com
Shared hosting (cpanel)
Linux CentOS
PHP: 5.2.17
MySQL: 5.1.52
Keywords in the action, exactly as they appear (in case that means anything):
... and it'll not doubt get bigger. Also running CKEditor 7.x-1.1 (what diff that could make, I have no idea, but there it is anyway).
I ran my site for years on Joomla with no real issues and, long story, decided to give Drupal a go. Got everything almost ready to go live with 6.whatever (can't even remember now), when a friend told me "uh, you know they're up to 7 now, right?" So I figured, screw it, rather than have to play catch-up later...
And now here I am. I'm gonna go get drunk now.
Comment #14
HansVdb CreditAttribution: HansVdb commentedI confirm grugnir's post #13 above. I have exactly the same error message in D7.8 in similar circumstances.
This issue should be re-opened.
Comment #15
catchThere is already an open issue for this at #244093: Node and comment actions are (still) completely broken and have broken tests too.