You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Note where a session was already started
Duplicated session starts can be annoying to debug. The error that
occurs when a session is already active doesn't tell you where it
was initialized, so figuring out the callsite involves manual
debugging to find it out.
This keeps track of the call site of session_start as a request
global, and frees at the end of the request. It should make it
easier to find these instances for PHP users.
The resulting message can look like:
Notice: session_start(): Ignoring session_start() because a session is already active (started from /home/calvin/src/php-src/inc.php on line 4) in /home/calvin/src/php-src/index.php on line 9
FixesGH-10721
* Convert to using zend_string for session start location
* Fix leak with session start callsite filename
If this was already initialized, we'd forget it. Have shared free
between session_start and RSHUTDOWN.
* For sessions that are automatically started, note that
Easy to forget that you have this set, in which case, session start
is done at RINIT outside of user code. Because this config option
can't change at runtime, we can check for it and make the error
more specific if that's the case.
php_error(E_NOTICE, "Ignoring session_start() because a session has already been started");
1512
+
if (PS(session_started_filename)) {
1513
+
php_error(E_NOTICE, "Ignoring session_start() because a session has already been started (started from %s on line %"PRIu32")", ZSTR_VAL(PS(session_started_filename)), PS(session_started_lineno));
1514
+
} elseif (PS(auto_start)) {
1515
+
/* This option can't be changed at runtime, so we can assume it's because of this */
1516
+
php_error(E_NOTICE, "Ignoring session_start() because a session has already been started automatically");
1517
+
} else {
1518
+
php_error(E_NOTICE, "Ignoring session_start() because a session has already been started");
php_error_docref(NULL, E_NOTICE, "Ignoring session_start() because a session is already active");
2543
+
if (PS(session_started_filename)) {
2544
+
php_error_docref(NULL, E_NOTICE, "Ignoring session_start() because a session is already active (started from %s on line %"PRIu32")", ZSTR_VAL(PS(session_started_filename)), PS(session_started_lineno));
2545
+
} elseif (PS(auto_start)) {
2546
+
/* This option can't be changed at runtime, so we can assume it's because of this */
2547
+
php_error_docref(NULL, E_NOTICE, "Ignoring session_start() because a session is already automatically active");
2548
+
} else {
2549
+
php_error_docref(NULL, E_NOTICE, "Ignoring session_start() because a session is already active");
0 commit comments