Server error inside mail compose after 7.2 Update

Moderator: crythias

Post Reply
khaed
Znuny newbie
Posts: 10
Joined: 16 Jan 2023, 11:10
Znuny Version: Znuny LTS 6.5.15
Real Name: Sebastian

Server error inside mail compose after 7.2 Update

Post by khaed »

Hello,

after updating from ZNUNY 7.1.7 to ZNUNY 7.2.3, i have problems answering within some tickets, i have also tried to update to 7.2.1 first, but the problem is still the same in both versions. My suggestion is, that it stems from the CKEditor migration from version 4 to 5...

The MigrateToZnuny7_2.pl did run smoothly:

Code: Select all

znuny@otrs-2017:~$ scripts/MigrateToZnuny7_2.pl

 Migration started ...

 Checking requirements ...

    Requirement check for: Check required Perl version ...
    Requirement check for: Check required Perl modules ...
    Requirement check for: Check if database has been backed up ...

        Did you backup the database? [Y]es/[N]o: y

    Requirement check for: Check required database version ...
    Requirement check for: Check database default storage engine ...
    Requirement check for: Check if CKEditor migration related entities have been backed up ...

        Did you backup the CKEditor entities? [Y]es/[N]o: y

    Requirement check for: Upgrade database structure ...
    Requirement check for: Check database charset ...
    Requirement check for: Migrate SysConfig settings ...

        Should the SysConfig be migrated? [Y]es/[N]o: y


 Executing tasks ...

    Step 1 of 23: Check required Perl version ...
    Step 2 of 23: Check required Perl modules ...
    Step 3 of 23: Check if database has been backed up ...
    Step 4 of 23: Check required database version ...
    Step 5 of 23: Check database default storage engine ...
    Step 6 of 23: Check if CKEditor migration related entities have been backed up ...
    Step 7 of 23: Upgrade database structure ...
    Step 8 of 23: Migrate database to utf8mb4 ...
    Step 9 of 23: Check database charset ...
    Step 10 of 23: Rebuild configuration ...
    Step 11 of 23: Migrate DBCRUD UUID columns ...
        Activity: Column dbcrud_uuid in table activity...
            Column already exists
        Calendar::Plugin: Column dbcrud_uuid in table calendar_appointment_plugin...
            Column already exists
        OAuth2Token: Column dbcrud_uuid in table oauth2_token...
            Column already exists
        OAuth2TokenConfig: Column dbcrud_uuid in table oauth2_token_config...
            Column already exists
        Translation: Column dbcrud_uuid in table translation...
            Column already exists
    Step 12 of 23: Migrate notification events ...
    Step 13 of 23: Integrate Znuny-MarkTicketSeenUnseen ...
    Step 14 of 23: Integrate Znuny-Translations ...
        Successfully deployed translations.
    Step 15 of 23: Migrate SysConfig settings ...
    Step 16 of 23: Migrate CKEditor from version 4 to 5 ...
Running CKEditor migration from version 4 to 5...
    Step 17 of 23: Uninstall merged packages ...
    Step 18 of 23: Initialize default cron jobs ...
    Copying /opt/znuny/var/cron/aaa_base.dist to /opt/znuny/var/cron/aaa_base...
    done.
    Copying /opt/znuny/var/cron/znuny_daemon.dist to /opt/znuny/var/cron/znuny_daemon...
    done.
    Step 19 of 23: Clean up the cache ...
    Step 20 of 23: Rebuild configuration another time ...
    Step 21 of 23: Deploy ACLs ...
    Step 22 of 23: Deploy processes ...
    Step 23 of 23: Check invalid settings ...

 Migration completed!
But afterwards, when i open the AgentTicketZoom of some tickets, and then try to answer and the new AgentTicketCompose window pops up, i get an 500 Internal Server Error. The Apache error.log states:

Code: Select all

[Fri Mar 20 11:37:38 2026] -e: Malformed UTF-8 character: \x8b (unexpected continuation byte 0x8b, with no preceding start byte) in substitution (s///) at /opt/znuny/Kernel/System/HTMLUtils.pm line 658.
[Fri Mar 20 11:37:38 2026] -e: Malformed UTF-8 character: \xed\xe8\xdd (unexpected non-continuation byte 0xe8, immediately after start byte 0xed; need 3 bytes, got 1) in substitution (s///) at /opt/znuny/Kernel/System/HTMLUtils.pm line 658.
[Fri Mar 20 11:37:38.175205 2026] [:error] [pid 1808:tid 1808] Malformed UTF-8 character (fatal) at /opt/znuny/Kernel/System/HTMLUtils.pm line 697.\n
Line 658 is: $Param{String} =~ s/(\n\r|\r\r\n|\r\n)/\n/gs;
Line 697 is: if ( $Param{String} =~ s/^(?!.*(?:\[%.*?%\]))(?!.*(?:<p>.*<\/p>))(.*?)([\r\n])/<p>$1<\/p>$2/gm ) {

Code: Select all

sub ToHTML {
    my ( $Self, %Param ) = @_;

    # check needed stuff
    for my $Needed (qw(String)) {
        if ( !defined $Param{$Needed} ) {
            $Kernel::OM->Get('Kernel::System::Log')->Log(
                Priority => 'error',
                Message  => "Need $Needed!"
            );
            return;
        }
    }

    # fix some bad stuff from opera and others
    $Param{String} =~ s/(\n\r|\r\r\n|\r\n)/\n/gs; <-THIS IS LINE 658

    $Param{String} =~ s/</&lt;/g;
    $Param{String} =~ s/>/&gt;/g;
    $Param{String} =~ s/"/&quot;/g;

    $Param{String} = $Self->ToHTMLReplaceWithParagraphs(
        String => $Param{String},
    ) if ( !$Param{DoNotReplaceWithParagraphs} );

    $Param{String} =~ s/  /&nbsp;&nbsp;/g if $Param{ReplaceDoubleSpace};

    return $Param{String};
}

Code: Select all

sub ToHTMLReplaceWithParagraphs {
    my ( $Self, %Param ) = @_;

    # check needed stuff
    for my $Needed (qw(String)) {
        if ( !defined $Param{$Needed} ) {
            $Kernel::OM->Get('Kernel::System::Log')->Log(
                Priority => 'error',
                Message  => "Need $Needed!"
            );
            return;
        }
    }

    if ( $Param{String} =~ s/^(?!.*(?:\[%.*?%\]))(?!.*(?:<p>.*<\/p>))(.*?)([\r\n])/<p>$1<\/p>$2/gm ) {   <-THIS IS LINE 697
        $Param{String} =~ s/(<\/p>([\r\n])){1}(?!<p>)(.+)/$1<p>$3<\/p>/sm;
    }
    $Param{String} =~ s/^(?=.*\[%.*?%\])(.*?)([\r\n])/$1$2<p><\/p>$2/gm;

    return $Param{String};
}
So my guess is, that some sourcetext from the mail i like to reply to has wrong format, like latin is being treated as utf8 or sort of something like this and after the update to the new CKeditor, it is some sort of problem now. Has anyone encountered something like this and might be able to nudge me into the right direction for a solution?

/edit
If i deactivate the Rich Text Editor in Sysconf "Frontend::RichText", the error is gone, so is suppose it is the CKeditor.
Post Reply