]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
remove pre-utf8mb4 emoji support
authorDylan William Hardison <dylan@hardison.net>
Mon, 15 Jul 2019 04:45:40 +0000 (00:45 -0400)
committerDylan William Hardison <dylan@hardison.net>
Mon, 15 Jul 2019 04:45:40 +0000 (00:45 -0400)
Bugzilla/Bug.pm
Bugzilla/Comment.pm
Bugzilla/Search.pm

index 535a8651c207bd63e196e6323dfc854d141378dc..ac549d40443a9d94b9390728735d9ad09d383ec8 100644 (file)
@@ -3755,17 +3755,6 @@ sub comments {
     foreach my $comment (@{$self->{'comments'}}) {
       $comment->{count} = $count++;
       $comment->{bug}   = $self;
-
-      # XXX - hack for MySQL. Convert [U+....] back into its Unicode
-      # equivalent for characters above U+FFFF as MySQL older than 5.5.3
-      # cannot store them, see Bugzilla::Comment::_check_thetext().
-      if ($is_mysql) {
-
-        # Perl 5.13.8 and older complain about non-characters.
-        no warnings 'utf8';
-        $comment->{thetext}
-          =~ s/\x{FDD0}\[U\+((?:[1-9A-F]|10)[0-9A-F]{4})\]\x{FDD1}/chr(hex $1)/eg;
-      }
     }
 
     # Some bugs may have no comments when upgrading old installations.
index 3bb9169112773a93dba0ffac78f436fbc21bde3a..ab50add430868abb29a54c47fcf7c8b6f61865ad 100644 (file)
@@ -440,20 +440,6 @@ sub _check_thetext {
   $thetext =~ s/\s*$//s;
   $thetext =~ s/\r\n?/\n/g;    # Get rid of \r.
 
-  # Characters above U+FFFF cannot be stored by MySQL older than 5.5.3 as they
-  # require the new utf8mb4 character set. Other DB servers are handling them
-  # without any problem. So we need to replace these characters if we use MySQL,
-  # else the comment is truncated.
-  # XXX - Once we use utf8mb4 for comments, this hack for MySQL can go away.
-  state $is_mysql = Bugzilla->dbh->isa('Bugzilla::DB::Mysql') ? 1 : 0;
-  if ($is_mysql) {
-
-    # Perl 5.13.8 and older complain about non-characters.
-    no warnings 'utf8';
-    $thetext
-      =~ s/([\x{10000}-\x{10FFFF}])/"\x{FDD0}[" . uc(sprintf('U+%04x', ord($1))) . "]\x{FDD1}"/eg;
-  }
-
   ThrowUserError('comment_too_long') if length($thetext) > MAX_COMMENT_LENGTH;
   return $thetext;
 }
index ddb3bef6273ac3dae7b9025f96ebab666281d310..017e8540690cdeda91a4c32f12beacd6f550bf30 100644 (file)
@@ -1790,7 +1790,6 @@ sub _handle_chart {
   $field = FIELD_MAP->{$field} || $field;
 
   my ($string_value, $orig_value);
-  state $is_mysql = $dbh->isa('Bugzilla::DB::Mysql') ? 1 : 0;
 
   if (ref $value eq 'ARRAY') {
 
@@ -1799,17 +1798,11 @@ sub _handle_chart {
     @$value = grep { defined $_ and $_ ne '' } @$value;
     return if !@$value;
     $orig_value = join(',', @$value);
-    if ($field eq 'longdesc' && $is_mysql) {
-      @$value = map { _convert_unicode_characters($_) } @$value;
-    }
     $string_value = join(',', @$value);
   }
   else {
     return if $value eq '';
     $orig_value = $value;
-    if ($field eq 'longdesc' && $is_mysql) {
-      $value = _convert_unicode_characters($value);
-    }
     $string_value = $value;
   }
 
@@ -1870,19 +1863,6 @@ sub _handle_chart {
   $condition->translated(\%search_args);
 }
 
-# XXX - This is a hack for MySQL which doesn't understand Unicode characters
-# above U+FFFF, see Bugzilla::Comment::_check_thetext(). This hack can go away
-# once we require MySQL 5.5.3 and use utf8mb4.
-sub _convert_unicode_characters {
-  my $string = shift;
-
-  # Perl 5.13.8 and older complain about non-characters.
-  no warnings 'utf8';
-  $string
-    =~ s/([\x{10000}-\x{10FFFF}])/"\x{FDD0}[" . uc(sprintf('U+%04x', ord($1))) . "]\x{FDD1}"/eg;
-  return $string;
-}
-
 ##################################
 # do_search_function And Helpers #
 ##################################