使用 Google Chrome 和 PHP 5.3 进行会话
我有一个 Auth 组件(基于 Zend_Auth),我在不同服务器和不同环境的许多项目中使用它。它一直有效......直到现在:
当我尝试使用 Google Chrome (12.0.742.122) 登录到新项目(使用相同的身份验证组件)时,我正在正确注销登录后。FF或IE不会出现此问题。
有谁知道为什么会这样?
I have an Auth component (based on Zend_Auth) which I am using in many projects on different servers and different environments. It has always worked... until now:
When I try to log in to a new project (using the same Auth component) with Google Chrome (12.0.742.122), I'm being logged out right after logging in. The problem doesn't occur with FF or IE.
Does anyone have a clue why this could be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这不是 ZF 的问题。尽管听起来很奇怪,但通过向您的网站添加网站图标即可解决该问题。 Chrome 正在发出对网站图标的请求,并在收到 404 错误时使会话无效。我读过一篇文章,其中建议特殊的 404 配置可能会有所帮助。
This is not a ZF issue. As strange as it may sound, the issue is solved by adding a favicon to your site. Chrome is making a request for the favicon and invalidating the session when it gets a 404. I read one post that suggested that a special 404 configuration might help.
可能是这个错误: http://framework.zend.com/issues/browse/ZF- 11502 - 评论中建议修复。
Might be this bug: http://framework.zend.com/issues/browse/ZF-11502 - there is a fix suggested in the comments.
这是一个奇怪的故事。如果你用谷歌搜索这个问题,你会发现它偶尔会出现在这里和那里,但从来没有系统地出现过。 Zend Framework 有一个错误报告,Google 论坛上有问题,Drupal 和 Wordpress 的跟踪系统中也有类似的报告。但不知何故,没有明确的答案。
就我而言,问题在其他一些重构过程中自行消失了。
It is a weird story. If you google the problem, you find that it sporadically turns up here and there but never systematically. There is a bug report for Zend Framework, there are issues at the Google Forums, there are similar reports in the tracking systems of Drupal and Wordpress. But somehow there are no clear answers.
In my case, the problem just went away by itself in the course of some other refactorings.
只是一个提示......我也遇到了同样的问题。调试后我发现主域上的 cookie 名称存在冲突。它在 FF 和 IE 中工作,但是 Chrome 为 ajax 请求使用顶级域 cookie,为常规请求使用较低域 cookie。
Just a hint ... I had the same problem. After debugging I found out there is a clash with cookie name on the main domain. It worked in FF and IE, Chrome however took a top domain cookie for ajax request and the lower one on regular request.