参考找到了预期大小均匀的列表 - OTRS 问题

问题描述

我的 OTRS 系统出现此错误,我无法弄清楚发生了什么。

系统日志错误

在执行 Execute() 时出错 Kernel::System::Console::Command::Maint::Ticket::PendingCheck: 参考发现平均大小的列表预期在 /opt/otrs/Kernel/System/GenericAgent.pm 第 988 行。

有问题的部分代码

# add note if wanted
if ( $Param{Config}->{New}->{Note}->{Body} || $Param{Config}->{New}->{NoteBody} ) {
    if ( $Self->{NoticeSTDOUT} ) {
        print "  - Add note to Ticket $Ticket\n";
    }

    my %Ticket = $Ticketobject->TicketGet(
        TicketID      => $Param{TicketID},DynamicFields => 0,);

    if ( IsHashRefWithData( \%Ticket ) ) {

        my %CustomerUserData = {}; # heres the line 988
        if ( IsstringWithData( $Ticket{CustomerUserID} ) ) {
            %CustomerUserData = $Kernel::OM->Get('Kernel::System::CustomerUser')->CustomerUserDataGet(
                User => $Ticket{CustomerUserID},);
        }

解决方法

您看到的消息是警告,而不是错误。如果您添加 use diagnostics;,您将获得有关该问题的更多详细信息:

(W misc) You gave a single reference where Perl was expecting a list
with an even number of elements (for assignment to a hash).  This
usually means that you used the anon hash constructor when you meant
to use parens.  In any case,a hash requires key/value pairs.

    %hash = { one => 1,two => 2,};    # WRONG
    %hash = [ qw/ an anon array / ];    # WRONG
    %hash = ( one => 1,);    # right
    %hash = qw( one 1 two 2 );                  # also fine

为避免警告,您可以更改:

my %CustomerUserData = {}; # heres the line 988

到:

my %CustomerUserData;

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...