小工具知识网

当前位置: 首页 > 行业知识 > 安塔利斯升级php8

行业知识

安塔利斯升级php8

2026-11-29 16:01:00 来源:互联网转载

1、includes/classes/class.Database.php 255行

()

multi_query方法加返回类型  :bool

query方法加返回类型:: mysqli_result|bool

()

2、includes/classes/class.Session.php on line 91

Optional parameter $planetID declared before required parameter $dpath is implicitly treated as a required parameter

$planetID = 0 这个参数必须放在参数列表的最后

3、includes/classes/Language.class.php:150 

During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Language::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice 

还是需要增加函数的返回类型

/** ArrayAccess Functions **/

    public function offsetSet($offset, $value) : void {

        if (is_null($offset)) {

            $this->container[] = $value;

        } else {

            $this->container[$offset] = $value;

        }

    }

    public function offsetExists($offset) : bool {

        return isset($this->container[$offset]);

    }

    public function offsetUnset($offset) : void{

        unset($this->container[$offset]);

    }

    public function offsetGet($offset) : string|array {

        error_log(json_encode($this->container[$offset]));

        

        return isset($this->container[$offset]) ? $this->container[$offset] : $offset;

    }

替换原有的4个方法

4、includes/classes/PlayerUtil.class.php on line  88

Optional parameter $UserLang declared before required parameter $planetNames is implicitly treated as a required parameter in 

还是又默认值得参数必须放在最后

5、includes/classes/class.theme.php

 Creation of dynamic property Theme::$skininfo is deprecated

不能在类得方法中,动态定义参数,必须在类得属性中先声明属性,方法中才能赋值

声明以下属性

public $skininfo; // 预先声明属性

public $skin; // 预先声明属性

public $customtpls;

6、includes/libs/Smarty/   整个替换smarty包

7、includes/classes/class.template.php

Undefined constant Smarty::PHP_REMOVE

注释掉这行

8、includes/libs/Smarty/sysplugins/smarty_internal_compile_private_modifier.php 112

注释掉出错代码

9、Undefined array key "page"  

删掉头文件中 id = page 的代码

10、includes/classes/class.PlanetRessUpdate.php  33

 Creation of dynamic property ResourceUpdate::$Builded is deprecated

还是动态属性问题,加入需要的属性即可

public $Builded;

    public $Build;

    public $Tech;

    public $USER;

    public $PLANET;

    public $GLOBALS;

    public $TIME;

    public $CONF;

    public $ProductionTime;

    public $HASH;

11、includes/pages/game/class.AbstractPage.php  132

 Trying to access array offset on value of type null

忽略掉警告即可

上一篇:如何搭建资料服务器?

下一篇:云服务器哪个地区好