PHP语法错误eval()'d code unexpected '$this' (T_VARIABLE)

问题遇到的现象和发生背景

itop更新代码时,出现以下报错,提示PHP语法错误。

Parse error: syntax error, unexpected '$this' (T_VARIABLE) in D:\wamp64\www\setup\modelfactory.class.inc.php(875) : eval()'d code on line 23

问题相关代码,请勿粘贴截图

部分代码:

<?php
/**
 * Copyright (C) 2013-2020 Combodo SARL
 *
 * This file is part of iTop.
 *
 * iTop is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * iTop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 */

/**
 * ModelFactory: in-memory manipulation of the XML MetaModel
 */

require_once(APPROOT.'setup/moduleinstaller.class.inc.php');
require_once(APPROOT.'setup/itopdesignformat.class.inc.php');
require_once(APPROOT.'setup/compat/domcompat.php');
require_once(APPROOT.'core/designdocument.class.inc.php');

/**
 * Special exception type thrown when the XML stacking fails
 *
 */
class MFException extends Exception
{
    /**
     * @var integer
     */
    protected $iSourceLineNumber;
    /**
     * @var string
     */
    protected $sXPath;
    /**
     * @var string
     */
    protected $sExtraInfo;

    const COULD_NOT_BE_ADDED = 1;
    const COULD_NOT_BE_DELETED = 2;
    const COULD_NOT_BE_MODIFIED_NOT_FOUND = 3;
    const COULD_NOT_BE_MODIFIED_ALREADY_DELETED = 4;
    const INVALID_DELTA = 5;
    const ALREADY_DELETED = 6;
    const NOT_FOUND = 7;
    const PARENT_NOT_FOUND = 8;


    /**
     * MFException constructor.
     *
     * @inheritDoc
     */

运行结果及报错内容
我的解答思路和尝试过的方法

我baidu过,网上说的哪里少符号,但是我判断不了哪里少符号了。

我想要达到的结果

不太懂PHP语法,有没有懂PHP的同学帮忙看看哪里有问题,谢谢

会不会这段代码有问题呢?


try
            {
                $this->ResetTempDictionary();
                foreach ($aDictionaries as $sPHPFile)
                {
                    $sDictFileContents = file_get_contents($sPHPFile);
                    $sDictFileContents = str_replace(array('<'.'?'.'php', '?'.'>'), '', $sDictFileContents);
                    $sDictFileContents = str_replace('Dict::Add', '$this->AddToTempDictionary', $sDictFileContents);
                    eval($sDictFileContents);
                }