Permalink
Browse files

Add '@' to the list of characters removed from radio/checkbox ID.

This character can easily show up in email addresses and can cause
invalid HTML.

Refs #2733
  • Loading branch information...
1 parent 405f3a1 commit ecf5aec1ae6e68d84dc2cb8c47edc54ae1d93863 @markstory markstory committed Feb 3, 2014
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Cake/View/Helper/FormHelper.php
View
2 lib/Cake/View/Helper/FormHelper.php
@@ -2083,7 +2083,7 @@ public function select($fieldName, $options = array(), $attributes = array()) {
*/
public function domIdSuffix($value, $type = 'html5') {
if ($type === 'html5') {
- $value = str_replace(array('<', '>', ' ', '"', '\''), '_', $value);
+ $value = str_replace(array('@', '<', '>', ' ', '"', '\''), '_', $value);
} else {
$value = preg_replace('~[^\\pL\d-_]+~u', '_', $value);
}

2 comments on commit ecf5aec

@AD7six
CakePHP member

To fix the bc break - this won't be sufficient for #2733.

The character . isn't in the list but it's missing an Inflector::camelize call too.

"GuidesSendToTestGmailCom" v
"GuidesSendToTest@gmail.com"
                 ^^    ^^

Hmz..

@markstory
CakePHP member

Maybe it would be best to remove the html5 branch of this code entirely.

Please sign in to comment.