ecshop使用PHP高版本报错解决办法

简介: 第一种Strict Standards: Non-static method cls_image::gd_version() should not be called statically inF:\xampp\htdocs\ceshi\includes\lib_base.

第一种

Strict Standards: Non-static method cls_image::gd_version() should not be called statically in
F:\xampp\htdocs\ceshi\includes\lib_base.php on line 346

解决办法:
按照文件路径,找到 return cls_image::gd_version();
修改为:
$p = new cls_image(); return $p->gd_version();

第二种

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in F:\xampp\htdocs\ceshi\includes\cls_template.php on line 300

解决办法:
按照文件路径,找到 return preg_replace("/{([^}{\n])}/e", "$this->select('\1');", $source);
修改为:
return preg_replace_callback("/{([^}{\n]
)}/", function($r){return $this->select($r[1]);}, $source);

第三种

Strict Standards: Only variables should be passed by reference in F:\xampp\htdocs\ceshi\includes\cls_template.php on line 422

解决办法:
按照文件路径,找到$tag_sel = array_shift(explode(' ', $tag));
修改为:
$tag_arr = explode(' ', $tag);
$tag_sel = array_shift($tag_arr);

第四种

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in F:\xampp\htdocs\ceshi\includes\cls_template.php on line 1074

解决方法
按照文件路径,找到
$pattern = '/.?/se';
$replacement = "'{include file='.strtolower('\1'). '}'";
$source = preg_replace($pattern, $replacement, $source);
修改为:
$pattern = '/.
?/s';
$replacement = function($r){return '{include file='.strtolower($r[1]). '}';};
$source = preg_replace_callback($pattern, $replacement, $source);

第五种

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in F:\xampp\htdocs\ceshi\includes\cls_template.php on line 496

解决方法
按照文件路径,找到
$out = "<?php \n" . '$k = ' . preg_replace("/('\$[^,]+)/e" , "stripslashes(trim('\1','''));", var_export($t, true)) . ";\n";
修改为:
$out = "<?php \n" . '$k = ' . preg_replace_callback("/('\$[^,]+)/", function(){return stripslashes(trim('\1','''));}, var_export($t, true)) . ";\n";

第六种

Strict Standards: Only variables should be passed by reference in F:\xampp\htdocs\ceshi\includes\lib_main.php on line 1329

解决办法
按照文件路径,找到
$ext = end(explode('.', $tmp));
修改为:
$ext = explode('.', $tmp);
$ext = end($ext);

第七种

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in F:\xampp\htdocs\ceshi\includes\cls_template.php on line 556

解决办法
按照文件路径,找到
$val = preg_replace("/[([^[]])]/eis", "'.'.str_replace('$','$','\1')", $val);
修改为:
$val =preg_replace_callback("/[([^[]]
)]/is", function(){return '.'.str_replace('$','$','\1');}, $val);

第八种

Strict Standards: Declaration of vbb::set_cookie() should be compatible with integrate::set_cookie($username = '', $remember = NULL)

解决办法
子类的函数跟父类的同名,必须使子类的函数参数跟父类的对应函数参数个数相同
依据错误提示,修改例如:
function set_cookie ($username="")
改为
function set_cookie ($username="", $remember = NULL)

第九种

Strict Standards: mktime(): You should be using the time() function instead in F:\xampp\htdocs\ceshi\admin\sms_url.php on line 31

解决办法
按照文件路径,找到
$auth = mktime();
修改为
$auth = time();

第十种

Strict Standards: Redefining already defined constructor for class alipay in F:\xampp\htdocs\ceshi\includes\modules\payment\alipay.php on line 85

解决方法
PHP 类,有两种构造函数,一种是跟类同名的函数,一种是__construct()。从PHP5.4开始,对这两个函数出现的顺序做了最严格的定义,必须是 __construct()在前,同名函数在后
例如:

function __construct()
{
    $this->paypal();
}
function paypal()
{
}
相关文章
|
PHP Apache
centos7.9 安装php7.0以上版本
centos7.9 安装php7.0以上版本
557 2
|
应用服务中间件 Shell PHP
pbootcms模板报错提示PHP Warning: Unknown: open_basedir restriction
pbootcms模板报错提示PHP Warning: Unknown: open_basedir restriction
|
关系型数据库 MySQL 应用服务中间件
win7系统搭建PHP+Mysql+Apache环境+部署ecshop项目
这篇文章介绍了如何在Windows 7系统上搭建PHP、MySQL和Apache环境,并部署ECShop项目,包括安装配置步骤、解决常见问题以及使用XAMPP集成环境的替代方案。
202 1
win7系统搭建PHP+Mysql+Apache环境+部署ecshop项目
|
IDE 安全 网络安全
Xdebug 在不同版本的 PHP 中配置方法有什么不同?
Xdebug 在不同版本的 PHP 中配置方法有什么不同?
542 4
|
PHP
PHP显示报错提示,开启display_errors的方法
PHP显示报错提示,开启display_errors的方法
332 0
|
Linux PHP
Linux CentOS 宝塔 Suhosin禁用php5.6版本eval函数详细图文教程
【8月更文挑战第27天】本文介绍两种禁用PHP执行的方法:使用`PHP_diseval_extension`禁用和通过`suhosin`禁用。由于`suhosin`不支持PHP8,仅适用于PHP7及以下版本,若服务器安装了PHP5.6,则需对应安装`suhosin-0.9.38`版本。文章提供了详细的安装步骤,并强调了宝塔环境下与普通环境下的PHP路径差异。安装完成后,在`php.ini`中添加`suhosin.so`扩展并设置`executor.disable_eval = on`以禁用执行功能。最后通过测试代码验证是否成功禁用,并重启`php-fpm`服务生效。
407 2
|
缓存 PHP C语言
宝塔PHP8.1安装fileinfo拓展失败解决办法
在宝塔面板安装PHP8.1后,fileinfo扩展安装失败,手动尝试也报错。通过分析错误信息,在Makefile中修改CFLAGS添加`-std=c99`,并执行`make clean`清除缓存后,重新编译安装成功。最后在php.ini中启用fileinfo扩展并重启PHP服务。注意需调整CFLAGS为`-std=c99 -g`,去掉`-O2`。
1486 0
|
PHP
PHP——oneinstack重新安装PHP的时候报错
PHP——oneinstack重新安装PHP的时候报错
231 4
|
Web App开发 关系型数据库 PHP
使用 Docker 快速搭建多版本 PHP 开发环境
使用 Docker 快速搭建多版本 PHP 开发环境
360 2
|
Java API PHP
【亲测有效,官方提供】php版本企查查api接口请求示例代码,php请求企查查api接口,thinkphp请求企查查api接口
【亲测有效,官方提供】php版本企查查api接口请求示例代码,php请求企查查api接口,thinkphp请求企查查api接口
585 1