【问题标题】:zombie.js lose session in callback僵尸.js 在回调中失去会话
【发布时间】:2013-10-03 23:36:28
【问题描述】:

我正在尝试使用 zombie.js 对 PHP 应用程序进行身份验证(尝试了 2 个 symfony2 应用程序,结果相同)。但是浏览器会话在回调中是不一样的。我认为这就是身份验证失败的原因。

这是我的 node.js 代码

var Browser = require("zombie");
var assert = require("assert");

// Load the page from localhost
var browser = new Browser();
browser.site = "http://localhost:8000/";
browser.loadCSS = false;
browser.debug = true;

browser.visit("app.php")
    .then(function(){
        console.log(browser.cookies.dump());

        browser.visit("app.php")
            .then(function() {
                console.log(browser.cookies.dump());
            });
    });

browser.visit("app.php")
    .then(function(){
        console.log(browser.cookies.dump());
    });

而且回调中phpssid不同的结果

$ node test.js    Zombie: Opened window http://localhost:8000/app.php 
Zombie: Closed window http://localhost:8000/app.php 
Zombie: Opened window http://localhost:8000/app.php 
Zombie: GET http://localhost:8000/app.php => 200
Zombie: GET http://localhost:8000/app.php => 200
Zombie: Loaded document http://localhost:8000/app.php
Zombie: GET http://localhost:8000/app.php/js/0b50c2c.js => 200
PHPSESSID=3qsqvtaseidgb5599803evt604; Domain=localhost; Path=/
[ true ]
Zombie: Closed window http://localhost:8000/app.php 
Zombie: Opened window http://localhost:8000/app.php 
PHPSESSID=3qsqvtaseidgb5599803evt604; Domain=localhost; Path=/
[ true ]
Zombie: GET http://localhost:8000/app.php => 200
Zombie: Loaded document http://localhost:8000/app.php
Zombie: GET http://localhost:8000/app.php/js/0b50c2c.js => 200
PHPSESSID=jg9h8e2orbmbfq0dr65ni8ucs7; Domain=localhost; Path=/
[ true ]
Zombie: Event loop is empty

是zombie.js的bug吗?

【问题讨论】:

    标签: php node.js session authentication zombie.js


    【解决方案1】:

    这是由于 php 5.4 内置服务器。 我已经升级到 php 5.5,就像一个魅力。

    我目前没有描述这种行为的链接。

    【讨论】:

      猜你喜欢
      • 2013-07-05
      • 2015-04-28
      • 2021-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多