Code
if (variable_get('ant_php_'. $node->type, 0) || module_exists('token')) {
$output = preg_replace('/[\t\n\r\0\x0B]/', '', strip_tags($output));
}
must be removed from function _auto_nodetitle_patternprocessor. Suppose I want node title to be 'x<y'. Currently if I return 'x<y' in php code I get 'x' as title because '<y' is stripped. If I return 'x<y' in php code I get 'x<y' as title.
This logic does not follow Drupal's guidelines of sanitizing text only during output:
When handling data, the golden rule is to store exactly what the user typed. When a user edits a post they created earlier, the form should contain the same things as it did when they first submitted it. This means that conversions are performed when content is output, not when saved to the database
Comments
Comment #1
TonyK commentedComment #2
bdsl commentedThis looks like the same issue as, or at least closely related to, #1071596: HTML Special characters in node title and #1052268: Special characters break creation of automatically generated node titles.
Comment #3
ambient.impactThis was giving me headaches in 7.x-1.0-alpha1 as well, until I tracked it down. Hoping this gets taken care of at some point.
Comment #4
dwwYes, this is definitely a bug. See my wider analysis at #1071596-35: HTML Special characters in node title. Bottom-line: auto_nodetitle should not be trying to filter the title on input. It's up to all the places displaying the title to filter on output.
Here are patches for both 7.x-1.x and 6.x-1.x.
Comment #5
mattbk commentedPatch in #4 doesn't seem to work for me, but others should try it to make sure.
Comment #6
pieterdcPatch for 7.x-1.0 in #4 does work for me. Thanks, @dww.
Comment #7
gaele commentedComment #8
anmolgoyal74 commentedThe patch doesn't apply anymore.
Comment #9
anmolgoyal74 commentedThis patch only removes strip_tags(). The function preg_replace() should be remain there to remove white spaces which has also been removed in patch given in #4.
Comment #11
gaurav.kapoor commented