login/register link generated when a user isn't allowed to comment, is transformed to html entities

netsensei - April 20, 2009 - 13:13
Project:Drupal
Version:7.x-dev
Component:comment.module
Category:bug report
Priority:normal
Assigned:netsensei
Status:closed
Issue tags:Quick fix
Description

When you a(n anonymous) user isn't permitted to comment, Drupal would show the link 'Login or register to post comments' below every comment. Login and register are both linking to their respective pages.

The links in this string are transformed to html entities by Drupal. This shows the links as a literal string rather then a true hyperlink in the users' webbrowser.

I've tracked the issue down to a missing html attribute boolean in the $links array which is generated by comment_links().

I couldn't find an issue that already reports this problem, so this is it.

I've attached two files:

1. screenshot of the issue
2. a patch which solves the issue

Anyone else seeing this?

AttachmentSizeStatusTest resultOperations
Picture 1.png44.05 KBIgnoredNoneNone
comment-forbidden-entities.patch753 bytesIdleFailed: Failed to install HEAD.View details

#1

earnie - April 20, 2009 - 14:03
Status:needs work» needs review

#2

mcrittenden - April 20, 2009 - 14:14

So how can I reproduce the error? Something like:

  1. Disallow anonymous users to post comments
  2. Log out
  3. Go and try to post a comment

That right?

#3

netsensei - April 20, 2009 - 14:32

Yes, that's right.

#4

pp - April 25, 2009 - 19:52
Status:needs review» reviewed & tested by the community

First of all. I see this patch, its good.

If you want to test it do the followings:

1. install the Drupal
2. add one new Article
3. add one or two comments to this article.
4. add "Access comments" permission to Anonymous user
5. log out

You see the problem when you see the article(node/1).

The patch resolve the bug.

#5

robomalo - April 25, 2009 - 19:55

This also worked for me.

#6

mcrittenden - April 25, 2009 - 20:00

Works for me also. Nice, simple patch. Let's get it in.

#7

pp - April 25, 2009 - 20:42
Status:reviewed & tested by the community» needs review

I added the test to it. Test is not good, I'am working on it.

AttachmentSizeStatusTest resultOperations
439148.patch4.34 KBIdleFailed: 11117 passes, 23 fails, 1 exceptionView details

#8

pp - April 25, 2009 - 21:04

Here is the corrected patch.

AttachmentSizeStatusTest resultOperations
439148-2.patch4.33 KBIdleFailed: Failed to run tests.View details

#9

pp - April 25, 2009 - 21:19

Add little typo.

AttachmentSizeStatusTest resultOperations
439148-3.patch4.38 KBIdleFailed: Failed to run tests.View details

#10

xmacinfo - April 25, 2009 - 22:13

Will this patch also correct this issue : #438224: "Post comments without approval" permission does not work by itself? Or do we need to tackle one issue before the other?

#11

xmacinfo - April 25, 2009 - 22:34

By the way, I was able to resolve this issue by deleting both D7 install and the database and reinstall from a fresh CVS copy. After that, the login/register link was perfectly displayed.

Did you try to reinstall D7 and the database completly before doing this patch?

#12

xmacinfo - April 25, 2009 - 22:44

Edited to erase this comment.

#13

tobiasb - April 26, 2009 - 09:15

reroll (http://drupal.org/cvs?commit=202766)

AttachmentSizeStatusTest resultOperations
439148_4.patch4.6 KBIdleFailed: 11111 passes, 23 fails, 62 exceptionsView details

#14

xmacinfo - April 26, 2009 - 15:31

I think this patch is obsolete. See me comment in #11. :-)

#15

pp - April 26, 2009 - 16:09

Did you read my comment #4 and see the picture? Did you add two comment to a node? Did you set Access comments permissions?

In this moment I get a fress CVS copy of Drupal, drop database, set permission Access comments and make all steps which in my comment #4 and bug is present.

pp

#16

xmacinfo - May 4, 2009 - 15:38

Thanks! Now I duplicated this error laud and clear. I'll try to review it later, unless someone beats me to it.

#17

System Message - May 1, 2009 - 12:00
Status:needs review» needs work

The last submitted patch failed testing.

#18

pp - May 4, 2009 - 09:28
Status:needs work» needs review

Reroll

AttachmentSizeStatusTest resultOperations
439148-5.patch4.38 KBIdleFailed: Failed to run tests.View details

#19

xmacinfo - May 4, 2009 - 15:40
Status:needs review» reviewed & tested by the community

I made sure I was able to reproduce the problem again. :-)

I've applied the patch and I can report that it corrects the error and that the text and links are displayed properly. From my point of view it's RTBC.

#20

mcrittenden - May 4, 2009 - 18:52

Looks good from my end as well.

#21

catch - June 1, 2009 - 20:19

Fixed up some phpdoc in the code comments, otherwise this is still RTBC. Since it's one line of real code and comes with tests, marking quick fix too.

AttachmentSizeStatusTest resultOperations
439148-5.patch4.38 KBIdlePassed: 11544 passes, 0 fails, 0 exceptionsView details

#22

Dries - June 1, 2009 - 22:03

I committed #470866: Comment links should use 'html' => TRUE -- this one might require a reroll. Let's ask the test bot ...

#23

webchick - June 20, 2009 - 07:30
Status:reviewed & tested by the community» fixed

The first hunk looks like it was committed as part of #470866: Comment links should use 'html' => TRUE, but it's nice to have test coverage for this. So committed the comment.test part to HEAD.

Thanks a bunch!!

#24

System Message - July 4, 2009 - 07:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.