升级tp5.0.21之后,设置default_filter问题

浏览:1336 发布日期:2018/09/27 分类:求助交流
如题,升级了5.0.21之后,设置default_filter字段中,有个mysql_real_escape_string过滤,然后报错:Fatal error: Uncaught exception 'think\exception\ErrorException' with message 'mysql_real_escape_string(): Access denied for user ''@'localhost' (using password: NO)' in D:\WWW\thinkphp_5.0.11_with_extend\thinkphp\library\think\Request.php:1083 Stack trace: #0 [internal function]: think\Error::appError(2, 'mysql_real_esca...', 'D:\\WWW\\thinkphp...', 1083, Array) #1 [internal function]: mysql_real_escape_string('GET') #2 D:\WWW\thinkphp_5.0.11_with_extend\thinkphp\library\think\Request.php(1083): call_user_func('mysql_real_esca...', 'GET') #3 D:\WWW\thinkphp_5.0.11_with_extend\thinkphp\library\think\Request.php(1029): think\Request->filterValue('GET', 'REQUEST_METHOD', Array) #4 D:\WWW\thinkphp_5.0.11_with_extend\thinkphp\library\think\Request.php(865): think\Request->input(Array, 'REQUEST_METHOD', NULL, '') #5 D:\WWW\thinkphp_5.0.11_with_extend\thinkphp\library\think\Request.php(522): think\Request->server('REQUEST_METHOD') #6 D:\WWW\thinkphp_5.0.11_with_extend\thinkphp\library\think\Request.php(637): think\Request->meth in D:\WWW\thinkphp_5.0.11_with_extend\thinkphp\library\think\Request.php on line 1083

Fatal error: Uncaught exception 'think\exception\ErrorException' with message 'mysql_real_escape_string(): Access denied for user ''@'localhost' (using password: NO)' in D:\WWW\thinkphp_5.0.11_with_extend\thinkphp\library\think\Request.php:1083 Stack trace: #0 [internal function]: think\Error::appError(2, 'mysql_real_esca...', 'D:\\WWW\\thinkphp...', 1083, Array) #1 [internal function]: mysql_real_escape_string('GET') #2 D:\WWW\thinkphp_5.0.11_with_extend\thinkphp\library\think\Request.php(1083): call_user_func('mysql_real_esca...', 'GET') #3 D:\WWW\thinkphp_5.0.11_with_extend\thinkphp\library\think\Request.php(1029): think\Request->filterValue('GET', 'REQUEST_METHOD', Array) #4 D:\WWW\thinkphp_5.0.11_with_extend\thinkphp\library\think\Request.php(865): think\Request->input(Array, 'REQUEST_METHOD', NULL, '') #5 D:\WWW\thinkphp_5.0.11_with_extend\thinkphp\library\think\Request.php(522): think\Request->server('REQUEST_METHOD') #6 D:\WWW\thinkphp_5.0.11_with_extend\thinkphp\library\think\Request.php(637): think\Request->meth in D:\WWW\thinkphp_5.0.11_with_extend\thinkphp\library\think\Request.php on line 1083
看了一下源码,暂时没找到原因,但是是连接数据库配置不生效,我试着在application/config.php 设置了连接数据库配置也无效;我知道是连接数据库的语句错了,但是我在控制器使用了db()->table('test')->select();
echo mysql_real_escape_string('test');
也是报错,所有得出,升级之后,不允许使用这个函数了,不知道是不是哪里底层实现的导致的
最佳答案
评论( 相关
后面还有条评论,点击查看>>