Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4008952
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:49:05+00:00 2026-05-20T08:49:05+00:00

In my framework, I make a number of calls to session_write_close(). Let’s assume that

  • 0

In my framework, I make a number of calls to session_write_close().

Let’s assume that a session has been initiated with a user agent. The following code…

foreach($i = 0; $i < 3; $i++) {
    session_start();
    session_write_close();
}

…will send the following request header to the browser:

Set-Cookie    PHPSESSID=bv4d0n31vj2otb8mjtr59ln322; path=/
              PHPSESSID=bv4d0n31vj2otb8mjtr59ln322; path=/

There should be no Set-Cookie header because, as I stipulated, the session cookie has already been created on the user’s end. But every call to session_write_close() after the first one in the script above will result in PHP instructing the browser to set the current session again.

This is not breaking my app or anything, but it is annoying. Does anyone have any insight into preventing PHP from re-setting the cookie with each subsequent call to session_write_close?

EDIT

The problem seems to be that with every subsequent call to session_start(), PHP re-sets the session cookie to its own SID and sends a Set-Cookie response header. But why??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T08:49:06+00:00Added an answer on May 20, 2026 at 8:49 am

    PHP does not recommend doing so, and there were bunch of bugs submitted for this. Since they think it’s not a good practice – this is the bug that is not going to be fixed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been thinking about creating a Java framework that would allow programmers to specify
Given Hadoop 0.21.0, what assumptions does the framework make regarding the number of open
I'll try to make a brief description of my Selenium framework so that I
I have a java program that has some number of classes. Three methods taken
Is it possible in Entity Framework to make a custom converter method for converting
Is there a way to make Entity Framework 4.1 Code First NOT to drop
I want to make a website in cakephp framework.but the important thing is I
We are looking to make a final decision on our Mocking framework. After trying
I want to make basic gui-tests with the ms ui automation framework, therefore i'm
I'm building a Zend Framework 1.11.11 application and would like to make the routes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.