framework
framework copied to clipboard
php8.1版本的htmlentities导致页面出错
htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated
tp8php8.2环境也同意会出现这样错误提示
tp8php8.3环境也同意会出现这样错误提示
tp8php8.3环境也同意会出现这样错误提示
麻烦提供下相关的详细信息,如详细错误信息和复现方式
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}
暂时可参考 https://github.com/top-think/think-template/pull/16 ,自定义一个函数,然后修改默认过滤方法
配置
暂时可参考 top-think/think-template#16 ,自定义一个函数,然后修改
默认过滤方法
配置 按这个方案修改报错:[2024-08-09T10:29:35+08:00][error] [0]Call to undefined function tp_htmlentities()
暂时可参考 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);
}
这个早就修正过 只是一直忘了发版了