I'm running a clean install of Drupal 4.7. Whenever I preview a comment I get the following error messages:

* Validation error, please try again. If this error persists, please contact the site administrator.
* The body of your comment is empty.

The body of my comment is not empty though and I can still save the comment. When I save, the comment shows up as normal, but this message is an annoyance and shouldn't be showing up.

This is definitely not theme specific because I get it with the Channel Nine and B7 and Blue Marine themes. I'm running the TinyMCE module as well. I've searched the forums previously and have not found this specific issue.

Has anyone seen this before and if so can you provide guidance?

Thanks in advance.

Comments

Anonymous’s picture

I removed access to TinyMCE and tried entering comments with just the plain text editor. No luck though. Still getting the same error messages when adding a new comment. I don't see the issue when replying to a comment that already exists.

Any assistance out there?

mjolley@buy-hot.com’s picture

I only get this when commenting on a poll. Other note types seem ok. The comment shows up fine in the preview but it does not post.

Interestingly, "preview comment optional" also isn't working for polls. Even though it's set to be optional, and even though I'm logged in as user #1, I am required to preview. Also, captcha only seems to work for polls, not other kinds of comments. Disabling captcha doesn't affect the validation error.

The error happens whether or not I use any terms. Nothing shows up in watchdog. Any ideas?

mjolley@buy-hot.com’s picture

Scary. Somehow some of my comment variables simply weren't in the database. Doing a comment configure fixed this. Yet the problem remains.

It's interesting that you mentioned TinyMCE because I now have the problem that the editor doesn't show up when viewing the thread. It shows up after a preview. Is this normal when comment entry isn't on a separate page?

mjolley@buy-hot.com’s picture

After fixing the variable problem I can now post but not preview. The error still only happens with polls for me but I think it's the same as the original problem.

Here's what I can tell about control flow:

  comment_form_add_preview
    comment_validate
      if (trim($edit['comment']) == '')
        form_set_error

Trim isn't the problem. It just strips whitespace. Here's callback setup for comment_form_add_preview:

  if ($op == t('Preview comment')) {
    $form['#after_build'] = array('comment_form_add_preview');
  }
  ...
  $form['preview'] = array('#type' => 'button', '#value' => t('Preview comment'), '#weight' => 19);

All this just says that the error occurs after the button is pressed. We already knew that. So the error is correct and the buffer is empty. So the code that fills in the buffer isn't being called soon enough? Why do we have a separate buffer anyway? I'll look into this.

mjolley@buy-hot.com’s picture

It looks like if I keep previewing over and over again, the validation error toggles off and on every time.

mjolley@buy-hot.com’s picture

I thought the code rlated to the "thread" comment field looked suspicious because it changed the database format. I tested it by changing a comment to the old format. The error still happened, so that's not the problem.

I verified that the content of the comment in the database doesn't change while previewing repeatedly. I'm starting to suspect unintended recursion. Some piece of code is being called with a bad "edit" reference. I'm not a PHP programmer so I don't know how references are done, but I doubt arrays are passed by value.

The error only happens when I reply to a node and not to another comment. The problem must be in an execution path that differs between node/reply and comment/reply. Comment_reply looks likely. Here's the code from 4.6.6:

    if ($pid) {
      $comment = db_fetch_object(db_query('SELECT c.*, u.uid, u.name AS registered_name, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d AND c.status = 0', $pid));
      $comment = drupal_unpack($comment);
      $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
      $output .= theme('comment_view', $comment);
    }
    else if (user_access('access content')) {
      $output .= node_view($node);
      $pid = 0;
    }

And the code from 4.7.0:

      if ($pid) {
        if ($comment = db_fetch_object(db_query('SELECT c.*, u.uid, u.name AS registered_name, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d AND c.status = %d', $pid, COMMENT_PUBLISHED))) {
          if ($comment->nid != $nid) {
            // Attempting to reply to a comment not belonging to the current nid.
            drupal_set_message(t('The comment you are replying to does not exist.'), 'error');
            drupal_goto("node/$nid");
          }
          $comment = drupal_unpack($comment);
          $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
          $output .= theme('comment_view', $comment);
        }
        else {
          drupal_set_message(t('The comment you are replying to does not exist.'), 'error');
          drupal_goto("node/$nid");
        }
      }
      else if (user_access('access content')) {
        $output .= node_view($node);
      }

Could the removal of this line have caused the error?

      $pid = 0;
mjohnq3’s picture

Not sure if you implied that adding that code back into the module would fix the problem, but it does not. When I try to add a comment to a node and preview it I receive the error but not when a comment is added to another comment. Interesting, no?

mjolley@buy-hot.com’s picture

I was going to test it but got sidetracked. Thanks for trying it out. I like the new "form quantity" theory which I might look into soon.

mjolley@buy-hot.com’s picture

But the toggling on/off of the error would not happen if the issue was about the number of forms on the page. I'm still thinking about toggling between odd and even levels of recursion. I've experienced this kind of behaviour in lots of situations.

It's even harder to fully examine the problem when you're dealing with callbacks. I'm not very experienced with any scripting language including PHP, and I don't know much about Drupal's architecture either. I only consider myself an expert in C and C++. Maybe we can get some real Drupal programmers to add some insight to this.

Anyway, I think there's almost certainly an invalid supposed pointer to that edit buffer on the stack at some point.

ericatkins’s picture

I am having the same issue with one of my sites. I hope this gets solved. It could freak out many users of my site.

mjohnq3’s picture

Does anyone experiencing this error have nodevote installed? On a clean install of Drupal 4.7.1 I only receive this error when nodevote is installed and enabled. Disabling nodevote eliminates the error.

Sam J Hain’s picture

I had nodevote module installed and activated when I came accross the error. The error displayed when previewing an add comment under a node. I disabled the nodevote module and the error did not display. Drupal version 4.7.2.

edit...

after further reading it would seem im a little late to offer any help other then to live with the error, or disable the module.

Gurpartap Singh’s picture

anyone please?

PREVIEW FOR POLLs WHEN COMMENTIN GIVES THAT ERROR.
no one willing to rectify?

heine’s picture

Please file a bugreport with steps to reproduce. I have a hunch that this is a problem because of two forms on one page; from the node (before voting) and from comment. This is just a hunch, we need steps to reproduce.

--
The Manual | Troubleshooting FAQ | Tips for posting | Make Backups! | Consider creating a Test site.

mjohnq3’s picture

There is an issue open for Nodevote concerning this error. See:

http://drupal.org/node/65782

mjolley@buy-hot.com’s picture

I wrote an issue a while ago regarding the difference between commenting on a node versus a comment, which is here:

http://drupal.org/node/63990

I think this is the umbrella issue, as I don't think it's specific to any non-core mod. The "multiple forms on a page" theory would invalidate this issue if shown to be true.

heine’s picture

Thank you for filing an issue! Please include as much info / insights in the issue itself.

--
The Manual | Troubleshooting FAQ | Tips for posting | Make Backups! | Consider creating a Test site.

mjolley@buy-hot.com’s picture

Well, the issue just links back here since this is where I posted everything I know on the subject :)

adeghord’s picture

Just put out my first poll, but I when I tried commenting - as admin - I got the error message noted above Validation error, please try again. If this error persists, please contact the site administrator. and the comment *does not* post. The second time I hit preview, the comment ups and disappears from the edit box - no toggling behaviour as described above. I've just upgraded to 4.7.2 and did not test comments on polls on 4.7.1 or 4.7.0. Comments are working fine on books and blogs. I repeat, this can't be a NodeVote issue for me, because I don't have that module installed.

Debian 3.1r0
Apache 1.3.33
PHP 4.4.2 (as CGI)
MySQL 5.0.18
Drupal 4.7.2
No non-core modules

burke’s picture

Ditto. For what it's worth, I ran into this error with a fresh install of 4.7.2. Created a poll, tried to add a comment to the poll, and got the Validation error, please try again. If this error persists, please contact the site administrator error message. It appears that this error is present "out of the box" with the poll module.

Looking forward to a bug fix for this. I'm forced to disable comments on polls for now. :o(

sin’s picture

I have the same error commenting pool when logged in, commenting works fine if I log out.

kmillecam’s picture

Running 4.7.2

Preview comment works BUT, it is accompanied with this message, "Validation error, please try again. If this error persists, please contact the site administrator."

Post comment works.

Kevin

http://www.webwiseone.com
It's all about community.

https://bkjdigital.com
We make magic.

Sam J Hain’s picture

What he said

4.7.2

dries’s picture

Does any of you have the backport.module or forms_api_backport.module installed? It would be great if you could provide us a list of all the contributed themes and modules that you have enabled. Try disabling them all, and see if the problem persists.

mjohnq3’s picture

On my test system -

WinXP Pro SP2, Xampp 1.5.1, Apache 2.2.0
PHP 5.1.1, APC 3.0.8, MySQL 5.0.18

with a clean install of Drupal 4.7.2, Bluemarine theme, and no contributed modules installed other than Nodevote 4.7.2

the Validation error occurs when either Admin or an Authenticated user previews a comment added to a node but not when previewing a reply added to a comment. The comment can be posted without any problem. When Nodevote is disabled the error is not received. I have not tried the Poll module but others have reported a problem with it also.

kmillecam’s picture

A solution has been posted here: http://drupal.org/node/70509#comment-132162

http://www.webwiseone.com
It's all about community.

https://bkjdigital.com
We make magic.