简体   繁体   中英

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. 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

<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.

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 . For backwards-compatibility breaks see this . Or generally all the section .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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