[drupal-devel] [bug] HTML entities possibly cut off when searching for a string
Issue status update for http://drupal.org/node/15121 Post a follow up: http://drupal.org/project/comments/add/15121 Project: Drupal Version: cvs Component: locale.module Category: bug reports Priority: normal Assigned to: Anonymous Reported by: jagdfalke Updated by: wulff -Status: active +Status: patch Attachment: http://drupal.org/files/issues/locale_15121.patch (1.25 KB) Patch for jagdfalke's fix attached. wulff Previous comments: ------------------------------------------------------------------------ Tue, 04 Jan 2005 19:41:12 +0000 : jagdfalke Hello, when one is searching for strings in admin/locale, HTML entities within the message strings are possibly cut off. (Text cut occurs within an entitiy, e.g. there's """ in the string and after the cut the string which is displayed ends with "&quo" e.g.) This leads to invalid (X)HTML, which I just noticed using a theme which not only uses XHTML, but also sends "application/xhtml+xml" as MIME-Type for the document. (Therefore a browser capable of XHTML will stop displaying the site if there is an obvious syntax error.) Regards, Milan ------------------------------------------------------------------------ Wed, 05 Jan 2005 14:31:29 +0000 : jagdfalke Ok, after having had this in the back of my head for some time, I thought that the simple fix would be to cut the string first, and apply htmlspecialchars then (since this function removes any entities, tags etc which would - when cut off - generate invalid markup, the problems is solved.) To do this, change lines 1053/1054 of includes/locale.inc, which look like this: <?php $source = htmlspecialchars($value['source']); $rows[] = array(array('data' => (strlen($source) > 150 ? substr($source, 0, 150) .'...' : $source) .'<br /><small>'. $value['location'] .'</small>'), array('data' => _locale_string_language_list($value['locales']), 'align' => 'center'), array('data' => l(t('edit'), "admin/locale/string/edit/$lid"), 'nowrap' => 'nowrap'), array('data' => l(t('delete'), "admin/locale/string/delete/$lid"), 'nowrap' => 'nowrap')); ?> to this: <?php $source = htmlspecialchars(strlen($value['source']) > 150 ? substr($value['source'], 0, 150) .'...' : $value['source']); $rows[] = array(array('data' => $source .'<br /><small>'. $value['location'] .'</small>'), array('data' => _locale_string_language_list($value['locales']), 'align' => 'center'), array('data' => l(t('edit'), "admin/locale/string/edit/$lid"), 'nowrap' => 'nowrap'), array('data' => l(t('delete'), "admin/locale/string/delete/$lid"), 'nowrap' => 'nowrap')); ?> (the line numbers are valid for my Drupal 4.5.1.) Regards, Milan ------------------------------------------------------------------------ Fri, 14 Jan 2005 15:33:33 +0000 : killes@www.drop.org If you set somethig to "patch" please include a patch file. Moving the issue to Drupal. ------------------------------------------------------------------------ Tue, 26 Jul 2005 11:25:19 +0000 : wulff Still exists in current HEAD.
participants (1)
-
wulff