[drupal-devel] [bug] Can't post comments when using PHP5

michaelsb drupal-devel at drupal.org
Sat Sep 3 22:58:52 UTC 2005


Issue status update for 
http://drupal.org/node/30354
Post a follow up: 
http://drupal.org/project/comments/add/30354

 Project:      Drupal
 Version:      cvs
 Component:    comment.module
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  michaelsb
 Updated by:   michaelsb
 Status:       patch (code needs review)
 Attachment:   http://drupal.org/files/issues/comment_15.patch (800 bytes)

I get the below warning and form error when trying to add comments to
any node (story, page, etc.) on a PHP 5.04 installation (Apache2,
Debian Sarge).


PHP warning:
"Warning: strtotime() [function.strtotime]: Called with an empty time
parameter. in /home/msb015/projects/drupal/modules/comment.module on
line 448."


Form error:
"You have to specify a valid date."


PHP5 backtrace:
#0  comment_validate(Array ([subject] => test,[comment] =>
test,[format] => 1,[cid] => ,[pid] => 0,[nid] => 5,[uid] => )) called
at [/home/msb015/projects/drupal/modules/comment.module:396]
#1  comment_reply(5) called at
[/home/msb015/projects/drupal/includes/menu.inc:354]
#2  call_user_func_array(comment_reply, Array ([0] => 5)) called at
[/home/msb015/projects/drupal/includes/menu.inc:354]
#3  menu_execute_active_handler() called at
[/home/msb015/projects/drupal/index.php:15]


As you can tell, there isn't a 'date' key in $edit (what's passed to
comment_validate()). After some debugging with the help of killes, we
managed to fix the problem with the attached patch. The patch passes
'now' to strtotime() if edit['date'] didn't exist.




michaelsb




More information about the drupal-devel mailing list