跳转到主要内容
dclnet 提交于 3 May 2016

这个提示是警告信息,虽然也不是致命错误,但是也是有几率出现的,目测是在php7中才有吧,好像我在php5.6环境中没看到

  • Warning: session_destroy(): Session callback expects true/false return value in user_logout() (line 178 ofD:\wamp\www\drupal7\modules\user\user.pages.inc).
  • Warning: session_destroy(): Session object destruction failed in user_logout() (line 178 of D:\wamp\www\drupal7\modules\user\user.pages.inc).

从提示可知应该是session会话注册的方法没按php要求返回布尔值,so

来到\modules\user\user.pages.inc的第178行,有代码

// Destroy the current session, and reset $user to the anonymous user.   session_destroy();

正常的php内置函数调用,那肯定是session_set_save_handler注册了drupal自己的函数来处理,搜索后找到 \includes\session.inc的函数 _drupal_session_destroy没有正确返回,so, 有return的改成return true;和在函数最后加一句return true;即可

最后,这样直接改drupal的核心代码是不怎么推荐的,但是,官方如果不升级修复这个bug,你又不想看到那个提示,这么干也没什么大碍。

Drupal 版本