Improper display of ampersand (&) in select list

capellic - August 28, 2008 - 14:59
Project:Content Taxonomy
Version:6.x-1.0-rc1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

Improper display of ampersand (&) in select list. When adding a taxonomy as a CCK field and displaying it as a "Select List", it displays as &. See screenshot attached

It displays as expected in when choosing "Checkboxes/Radios".

AttachmentSize
Select List with ampersands22 KB

#1

mh86 - August 29, 2008 - 11:29
Status:active» fixed

Hi!

Thanks for your report.
There was one check_plain too much for select lists, I fixed that and committed it to the D6 dev version.

#2

Anonymous (not verified) - September 12, 2008 - 12:53
Status:fixed» closed

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

#3

ck9 - June 12, 2009 - 14:59
Version:6.x-1.0-beta3» 6.x-1.0-rc1
Status:closed» active

I have this issue in 6.x-1.0-rc1. The ampersand in select lists is rendered as &amp.

#4

ck9 - June 19, 2009 - 07:08
Priority:normal» critical

This is important any ideas please?

#5

mh86 - June 19, 2009 - 07:19

this may also depend on your CCK version. what version of cck are you using and is there a difference between content taxonomy beta6 and rc1?

#6

ck9 - June 20, 2009 - 01:24

I just tried upgrading to the latest CCK module (6.x-2.4) and the problem remains. I have Content Taxonomy 6.x-1.0-rc1. Please advise, thanks.

#7

ck9 - June 20, 2009 - 22:33

Now tried the 6.x dev but no difference.

#8

ck9 - June 20, 2009 - 22:52
Priority:critical» normal

Out of desperation I tried editing it myself and by some miracle actually fixed it. I've attached a patch although I wrote it by hand and not sure if it follows the proper convention for patches. Either way it should be clear which line was changed.

AttachmentSize
content_taxonomy-correct_imroper_display_of_ampersands.patch 504 bytes

#9

mh86 - July 15, 2009 - 12:53

removing check_plain is a bad idea and dangerous. additionally your patch wouldn't change anything for select list. maybe you have been adding another check_plain instead?

#10

ck9 - July 16, 2009 - 00:25

If the check_plain is left in then the ampersands are displayed incorrectly. I'm not sure why nobody else is having this problem.

If anyone has an alternative solution then I'd be happy to try it, but this hack allowed an otherwise ready site to go live (even if removal of the check_plain impairs security).

#11

mh86 - August 19, 2009 - 10:07
Status:active» postponed (maintainer needs more info)

I'm still wondering, why this patch changes something with select lists. The original code says:

$options[$term->tid] = ($field['widget']['type'] == 'content_taxonomy_select') ? $value : check_plain($value);

it does a check_plain for every widget (like radios/checkboxes), except for a select list.
if you remove the second check_plain it only can have effects on widget not of the type 'content_taxonomy_select'.
so, I have to ask again, which widget are you exactly using? you can see that in your field settings or in your database (table content_node_field_instance)

 
 

Drupal is a registered trademark of Dries Buytaert.