Skip to content
This repository was archived by the owner on Jul 15, 2022. It is now read-only.
This repository was archived by the owner on Jul 15, 2022. It is now read-only.

only last cookie is sent #16

Description

@meaninglessidentifier

if php's setcookie is called multiple times per response, only the last cookie will be included in the response.

for example, the response from the following php code will include only the "bbb" cookie.

<?php
setcookie("aaa", "xxx");
setcookie("bbb", "zzz");

for contrast, the following express code works as expected.

var express = require('express');
var app = express();
app.get('/', function(req, res){
  res.cookie('aaa', 'zzz');
  res.cookie('bbb', 'xxx');
  res.send('z');
});
app.listen(9090);

this prevents wordpress from functioning as its authentication process sets multiple cookies in a single request. (cf wp_set_auth_cookie in wp-includes/pluggable.php.)

i have tried using the version of node-php currently available from npm as well as the current head on github with the same results. am i doing something wrong?

edit: in case it's relevant, here is the code that i am using to start the server:

var express = require('express');
var php = require("node-php");
var app = express();
app.use("/", php.cgi(__dirname+"/cookietest"));
app.listen(9090);

edit2: and just in case this is relevant...

$ php-cgi --version
PHP 5.5.9-1ubuntu4.20 (cgi-fcgi) (built: Oct  3 2016 13:02:14)
...

edit3: i've also confirmed that the above php code works as expected when served by invoking the php executable as follows

$ php -S 127.0.0.1:9090 -t ./cookietest/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions