After updating this module, the classes with an underscore in the name were converted to a dash. It is also reported that it changes upper case to lower case in an effort to conform to drupal_html_class and conform to drupal coding standards.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 2636548-14-againstHEAD.patch | 849 bytes | mbaynton |
| #10 | 2636548-10-against2.2.patch | 969 bytes | mbaynton |
| #10 | 2636548-10-against2.1.patch | 1.38 KB | mbaynton |
Comments
Comment #2
spanners commentedI had exactly the same issue. All underscores in the block class field were converted to dashes.
Comment #3
caspianroach commentedThis is a serious problem that will potentially break hundreds of sites on updating. Using drupal_html_class() on end user admins is not good, because it tries to 'adhere to Drupal coding standards' which may differ completely with the standards of the site's administration. Hard-coding a coding standard for a public product is a very selfish and stupid idea. Custom block classes should not be subjugated to coding standards because this will only lead to people hacking the module to get rid of this garbage making them stop receiving security updates.
Underscores are a perfectly valid symbol in CSS identifier names that cause no harm whatsoever and it should be up to the end user to decide whether to use them or not. Please replace all instances of drupal_html_class() in the newest version with something else, like a function of your own.
https://api.drupal.org/api/drupal/includes!common.inc/function/drupal_ht...
https://api.drupal.org/api/drupal/includes!common.inc/function/drupal_cl...
Comment #4
jmclean commentedPossible patch:
Comment #5
jmclean commented(Something went wrong with my first comment - trying again)
Instead of calling drupal_html_class($class), this module should use drupal_clean_css_identifier($class, array('/' => '-', '[' => '-', ']' => '')).
Comment #6
cfm4n commentedI completely agree with caspianroach - I was appalled yesterday when I ran the update on a couple of dev sites, and it broke my headers & logos because I used underscores in the class name. That would mean me modifying the CSS in 70+ sites in our multisite - this is not a good fix. Please revert this!!
Comment #7
nicolas bouteille commentedTotally agree with the above. Even though this is a small module, I am glad I tested this locally first! ^^
And I would think that such a change should require a new major version with proper warning and documentation... not a minor one, especially a security one.
Comment #8
mbayntonAgreed, the security fix is too disruptive and will be breaking sites across the interwebs today. I'm going to invest a little time in an alternative patch now. If the module maintainer agrees that the security release needs a revision, we should do it asap.
Comment #9
Chewits commentedIt seems to convert upper case letters to lower case, that breaks styles, too..
Comment #10
mbayntondrupal_html_class goes beyond security sanitization to create class names observing drupal coding standards. While we all love drupal coding standards, they should not start getting enforced as part of a security patch at the cost of breaking everyone's site.
Attached are patches against 2.1 (pre-security update) and 2.2 (post securitiy update) that simply sanitize the class names for security, and do not force them to conform to drupal's coding standards. Hopefully these get committed.
Comment #11
mbayntonI should mention, if you are having issues with the security fix and the patch works, please comment here and/or mark the issue "Reviewed and tested by the community"
Comment #14
mbayntonHmm, reroll against HEAD?
Comment #15
erok415 commented@cfm4n (#6) I completely agree with you and this is a problem.
Comment #16
sgdev commentedReviewed the patch and it makes sense. Also tested #14 and it applies cleanly and functions correctly.
Should get a new version out there as soon as possible, since I'm sure quite a few people impacted by this!
Comment #17
sonicthoughts commentedComment #19
berenddeboer commentedThanks guys, totally didn't know drupal_html_class() was that aggresive!