Bug #74514 [Com]: PHP Warning: session_name(): Cannot change session name when headers already

From: Date: Sun, 07 May 2017 09:06:18 +0000
Subject: Bug #74514 [Com]: PHP Warning: session_name(): Cannot change session name when headers already
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208985@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74514&edit=1

 ID:                 74514
 Comment by:         spam2 at rhsoft dot net
 Reported by:        spam2 at rhsoft dot net
 Summary:             PHP Warning:  session_name(): Cannot change session
                     name when headers already
 Status:             No Feedback
 Type:               Bug
 Package:            Session related
 Operating System:   Linux
 PHP Version:        master-Git-2017-04-29 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

WTF - did you even read the error message from the initial report and the fact calling the function
without parameters is not supposed to write any headers or start a session - i just want the current
setting to parse out the session cookie from response headers on that same machine 

However, do what you want, as I said for my use case ini_get is a workaround while it could be
prohibited on production machines and when session_name changed the name it is probably no longer
the same value


Previous Comments:
------------------------------------------------------------------------
[2017-05-07 04:22:37] php-bugs at lists dot php dot net

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.

------------------------------------------------------------------------
[2017-04-29 23:05:13] spam2 at rhsoft dot net

http://php.net/manual/en/function.session-name.php

> session_name() returns the name of the current session. If name is given, 
> session_name() will update the session name and return the old session name
_____________

$session_name = session_name();

do you see a name given here?

------------------------------------------------------------------------
[2017-04-29 23:01:28] spam2 at rhsoft dot net

just run a CLI script with no session started - the line from te origin report is one of many
thousands and it's intention is to work environment independet and get/send the correct cookie
for thousands of curl calls

i will rewrite the code now to "ini_get('session.name'); but that don't change
the fact that there is some BC change

------------------------------------------------------------------------
[2017-04-29 22:51:57] daverandom@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



------------------------------------------------------------------------
[2017-04-29 22:32:21] spam2 at rhsoft dot net

Description:
------------
[30-Apr-2017 00:16:55 Europe/Vienna] PHP Warning:  session_name(): Cannot change session name when
headers already sent in /Volumes/dune/www-servers/cms/cms/autotests/suite/backend.php on line 40

for *sure* not

line 40 is "$session_name = session_name();"

nobody is asking here for any change



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74514&edit=1


Thread (9 messages)

« previous php.bugs (#208985) next »