【修复】ShopWind报错“Array and string offset access” 的解决办法

风清扬 发布于 BUG提交 2021-10-25 02:01:55

问题:ShopWind V3.3.0 开源电商系统 后台管理点击“插件”栏目内的子栏目时,提示错误 “ Array and string offset access syntax with curly braces is deprecated.. ” 如下图所示

原因:PHP 7.4不再支持使用大括号来访问数组以及字符串的偏移,故而提示错误。

解决办法:

1. 找到文件:common\plugins\BasePlugin.php 和 common\library\Widget.php

将代码:

 if (in_array($entry, array('.', '..')) || $entry{0} == '.' || $entry{0} == '$') { 

修改为:

 if (in_array($entry, ['.', '..']) || in_array(substr($entry, 0 ['.', '$'])) {

2.找到文件:backend\models\DbForm.php

将代码(有两处):

 $file{0} != '.' 

修改为:

 !in_array($file, ['.', '..']) 

3. 找到文件:common\plugins\connect\xwb\lib\SaeTOAuthV2.php

将代码:

 if( in_array($parameter, array('pic', 'image')) && $value{0} == '@' ) { 

修改为:

 if( in_array($parameter, array('pic', 'image')) && substr($value, 0, 1) == '@' ) { 

问题解决!

最后编辑于 2023-04-06 12:23:50
0 1179
Re :

风清扬 这家伙什么都没留下

  • 回答

    6
  • 发布

    25
  • 经验

    1270

内容精选

联系我们

  • 微信官网

    关注公众号

    系统更新,推送提醒
  • 开发交流群

    技术交流Q群

    安装使用,开发交流

垂询热线:18978189162