简体   繁体   English

PHP 5.6和7.0中的htmlentities问题

[英]PHP issue with htmlentities in 5.6 and 7.0

I have recently upgraded from PHP 5.6 to PHP 7.0 on AWS EC2 instance. 我最近在AWS EC2实例上从PHP 5.6升级到PHP 7.0。 I have a code as below 我有如下代码

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

in PHP 5.6 is working as required but in 7.0 it is giving following warning 在PHP 5.6中按要求工作,但在7.0中则给出以下警告

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

Now I need to know it is due to version change or anything else. 现在,我需要知道这是由于版本更改或其他原因引起的。 Any documentation or link in support of your answer will be really helpful. 任何支持您答案的文档或链接将非常有帮助。

As others suggested in comments: The self::$_variable contains an array so htmlentities fails when run no matter what PHP version (greater or equal to 4) you use. 正如其他人在注释中建议的那样: self::$_variable包含一个数组,因此无论您使用哪个PHP版本(大于或等于4), htmlentities无法运行。

See an online example here . 在此处查看在线示例。 The documentation link you requested can be found here . 您要求的文档链接可以在这里找到。

For changes between PHP 5.6 and 7.0 see this article . 有关PHP 5.6和7.0之间的更改,请参见本文 For backwards-compatibility breaks see this . 有关向后兼容的信息,请参见this Or generally all the section . 或一般全部

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM