When submitting a comment on a project issue, user is bumped back to project form. Any 'description' entered is lost. No error message is given. Identical result on preview.

Comments

nedjo’s picture

I've tracked this issue down to the use of object casting. We replaced $edit = (array2object($_POST['edit'])); with $edit = (object) $_POST['edit']; in project_comment_page()--but the result isn't equivalent. When I return it to array2object()

What do we do elsewhere to read in a node object from a form post operation?

dries’s picture

I don't see any difference:

Original array taken from issue follow-up submit:

Array
(
    [pid] => 3281
    [rid] => 5752
    [component] => Issues
    [category] => bug
    [priority] => 1
    [assigned] => 0
    [sid] => 1
    [title] => /project/issues/event lists Aggregator2 issues
    [body] => 
    [format] => 1
    [wizard] => two
    [form_id] => project_comment_form
)

Casted with (object):

stdClass Object
(
    [pid] => 3281
    [rid] => 5752
    [component] => Issues
    [category] => bug
    [priority] => 1
    [assigned] => 0
    [sid] => 1
    [title] => /project/issues/event lists Aggregator2 issues
    [body] => 
    [format] => 1
    [wizard] => two
    [form_id] => project_comment_form
)

Casted with array2object():

stdClass Object
(
    [pid] => 3281
    [rid] => 5752
    [component] => Issues
    [category] => bug
    [priority] => 1
    [assigned] => 0
    [sid] => 1
    [title] => /project/issues/event lists Aggregator2 issues
    [body] => 
    [format] => 1
    [wizard] => two
    [form_id] => project_comment_form
)

Looks identical to me...

dries’s picture

On line 19, we call project_comment_form:
$output .= project_comment_form($edit, $param);
However, $param isn't initialized ... maybe that is the problem?

hunmonk’s picture

i installed project module on a fresh copy of HEAD, and i'm not getting this problem. not sure how else i can be of help :)

dries’s picture

Odd. It's easy to reproduce on scratch.drupal.org.

nedjo’s picture

With fresh HEAD versions of Drupal and project module installed from scratch today I still get the problem--submitting a comment on a project issue returns to the comment form and no comment is saved.

Yes, I was wrong about the object casting, no issue there.

Further testing shows that the project_comment_page function is being called twice; the first time it has access to POST data, but the second it doesn't. This looks very similar to the issue causing bug http://drupal.org/node/50337.

dries’s picture

Status: Active » Fixed

Fixed it in CVS HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)