在期望大小相等的列表的位置找到引用-OTRS问题



我的OTRS系统上出现了这个错误,我不知道发生了什么。

系统日志错误:

在中执行Execute((时出错内核::系统::控制台::命令::维护::票证::挂起检查:在偶数大小的列表中找到引用/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 $Ticketn";
}
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, two => 2, );    # right
%hash = qw( one 1 two 2 );                  # also fine

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

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

至:

my %CustomerUserData;

最新更新