PHP 5.6 和 7.0 中的 htmlentities 问题

PHP issue with htmlentities in 5.6 and 7.0

我最近在 AWS EC2 实例上从 PHP 5.6 升级到 PHP 7.0。我有如下代码

stripslashes(htmlentities(self::$_variable));

在 PHP 5.6 中按要求工作,但在 7.0 中给出以下警告

<b>Warning</b>:  htmlentities() expects parameter 1 to be string, array given in 

现在我需要知道这是由于版本更改或其他原因造成的。支持您的答案的任何文档或 link 都将非常有帮助。

正如其他人在评论中建议的那样:self::$_variable 包含一个数组,因此当 运行 时 htmlentities 失败,无论您使用什么 PHP 版本(大于或等于 4)使用。

查看在线示例 here. The documentation link you requested can be found here

有关 PHP 5.6 和 7.0 之间的更改,请参阅 this article. For backwards-compatibility breaks see this. Or generally all the section