framework icon indicating copy to clipboard operation
framework copied to clipboard

php8.1版本的htmlentities导致页面出错

Open wangdake123 opened this issue 1 year ago • 1 comments

htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated

wangdake123 avatar May 22 '23 03:05 wangdake123

tp8php8.2环境也同意会出现这样错误提示

rainbowder avatar Dec 01 '23 10:12 rainbowder

tp8php8.3环境也同意会出现这样错误提示

vincenthou2016 avatar Aug 08 '24 02:08 vincenthou2016

tp8php8.3环境也同意会出现这样错误提示

麻烦提供下相关的详细信息,如详细错误信息和复现方式

big-dream avatar Aug 08 '24 07:08 big-dream

tp8php8.3环境也同意会出现这样错误提示

麻烦提供下相关的详细信息,如详细错误信息和复现方式

[2024-08-08T10:29:10+08:00][error] [8192]htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated
#0 [internal function]: think\initializer\Error->appError(8192, 'htmlentities():...', '/www/sites/book...', 82)
#1 /www/sites/book.cc/index/runtime/admin/temp/19d21c06194b772918ecdb3b0af5bc2e.php(82): htmlentities(NULL)
#2 /www/sites/book.cc/index/vendor/topthink/think-template/src/template/driver/File.php(60): include('/www/sites/book...')
#3 /www/sites/book.cc/index/vendor/topthink/think-template/src/Template.php(250): think\template\driver\File->read('/www/sites/book...', Array)
#4 /www/sites/book.cc/index/vendor/topthink/think-view/src/Think.php(131): think\Template->fetch('/www/sites/book...', Array)
#5 /www/sites/book.cc/index/vendor/topthink/framework/src/think/View.php(90): think\view\driver\Think->fetch('/www/sites/book...', Array)
#6 /www/sites/book.cc/index/vendor/topthink/framework/src/think/View.php(122): think\View->think\{closure}()
#7 /www/sites/book.cc/index/vendor/topthink/framework/src/think/View.php(89): think\View->getContent(Object(Closure))
#8 /www/sites/book.cc/index/vendor/topthink/framework/src/think/response/View.php(92): think\View->fetch('edit', Array)
#9 /www/sites/book.cc/index/vendor/topthink/framework/src/think/Response.php(389): think\response\View->output('edit')
#10 /www/sites/book.cc/index/vendor/topthink/framework/src/think/Response.php(131): think\Response->getContent()
#11 /www/sites/book.cc/index/public/index.php(39): think\Response->send()
#12 {main}

vincenthou2016 avatar Aug 08 '24 07:08 vincenthou2016

暂时可参考 https://github.com/top-think/think-template/pull/16 ,自定义一个函数,然后修改默认过滤方法配置

big-dream avatar Aug 08 '24 10:08 big-dream

暂时可参考 top-think/think-template#16 ,自定义一个函数,然后修改默认过滤方法配置 按这个方案修改报错: [2024-08-09T10:29:35+08:00][error] [0]Call to undefined function tp_htmlentities()

vincenthou2016 avatar Aug 09 '24 02:08 vincenthou2016

暂时可参考 top-think/think-template#16 ,自定义一个函数,然后修改默认过滤方法配置 按这个方案修改报错: [2024-08-09T10:29:35+08:00][error] [0]Call to undefined function tp_htmlentities()

自己在 app/common.php 文件自定义一个函数。

function tp_htmlentities($str)
{
    return htmlentities((string)$str);
}

big-dream avatar Aug 09 '24 02:08 big-dream

这个早就修正过 只是一直忘了发版了

liu21st avatar Aug 12 '24 05:08 liu21st