mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
180f785404
* 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 Fixes GH-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.
40 lines
1.0 KiB
PHP
40 lines
1.0 KiB
PHP
--TEST--
|
|
Test session_start() function : variation
|
|
--EXTENSIONS--
|
|
session
|
|
--SKIPIF--
|
|
<?php include('skipif.inc'); ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
ob_start();
|
|
|
|
echo "*** Testing session_start() : variation ***\n";
|
|
|
|
var_dump(session_start());
|
|
var_dump(session_start());
|
|
var_dump(session_start());
|
|
var_dump(session_start());
|
|
var_dump(session_start());
|
|
|
|
session_destroy();
|
|
echo "Done";
|
|
ob_end_flush();
|
|
?>
|
|
--EXPECTF--
|
|
*** Testing session_start() : variation ***
|
|
bool(true)
|
|
|
|
Notice: session_start(): Ignoring session_start() because a session is already active (started from %s on line %d) in %s on line %d
|
|
bool(true)
|
|
|
|
Notice: session_start(): Ignoring session_start() because a session is already active (started from %s on line %d) in %s on line %d
|
|
bool(true)
|
|
|
|
Notice: session_start(): Ignoring session_start() because a session is already active (started from %s on line %d) in %s on line %d
|
|
bool(true)
|
|
|
|
Notice: session_start(): Ignoring session_start() because a session is already active (started from %s on line %d) in %s on line %d
|
|
bool(true)
|
|
Done
|