问题描述
我今天面对phpCas库。
I am facing a problem today with the phpCas library https://wiki.jasig.org/display/CASC/phpCAS.
问题如下,当我尝试使用某些注销功能时,收到消息
Problem is the following, when I try to use some logout function, I got the message
Warning: session_destroy(): Trying to destroy uninitialized session
快速浏览了phpCas的库代码后,我设法弄清了问题的根源,这是注销功能的代码段:
After giving a quick look into the phpCas's library code, I manage to figure out where the problem comes from, here is a snippet of a logout function :
session_write_close();
header('Location: '.$cas_url);
phpCAS::trace("Prepare redirect to : ".$cas_url);
session_unset();
session_destroy();
那里的问题似乎是 session_write_close()
实际上关闭了会话,然后 session_destroy()
无法工作。
The problem there it seems is that session_write_close()
actually close the session then session_destroy()
can't work.
试图在 session_write_close()
中添加注释,并且看起来很吸引人,但它引出了两个问题:
Tried to put the session_write_close()
in comment and worked like a charm but it leads to two questions :
-
问题真的来自那里吗?还是应该起作用?
Is the problem really coming from there? Or should it work?
如果问题确实出在那儿,为什么会出现在那儿而没人抱怨呢?认为phpCas是许多人使用的知名库。
If the problem do really come from there, why is it there and nobody complaining? Thought phpCas was a reknown library used by many.
推荐答案
像您一样的声音检出了master分支(2af859ff76)-刚刚检查过,但确实有错误。您应该:
Sounds like you checked out the master branch (2af859ff76) - just checked and it does have an error in it. You should:
- 签出一个发行分支,如1.3稳定
- 登录此作者的错误
这篇关于警告:session_destroy():试图用phpCas破坏未初始化的会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!