mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-15 05:59:50 +00:00
Initializing CakeSession class only when required, mixing procedural code with class definitions is not good
This commit is contained in:
parent
399c293b77
commit
7b586369e0
1 changed files with 6 additions and 6 deletions
|
@ -125,10 +125,9 @@ class CakeSession {
|
|||
* Constructor.
|
||||
*
|
||||
* @param string $base The base path for the Session
|
||||
* @param boolean $start Should session be started right now
|
||||
* @return void
|
||||
*/
|
||||
public static function init($base = null, $start = true) {
|
||||
public static function init($base = null) {
|
||||
self::$time = time();
|
||||
|
||||
$checkAgent = Configure::read('Session.checkAgent');
|
||||
|
@ -181,6 +180,7 @@ class CakeSession {
|
|||
if (self::started()) {
|
||||
return true;
|
||||
}
|
||||
CakeSession::init();
|
||||
$id = self::id();
|
||||
session_write_close();
|
||||
self::_configureSession();
|
||||
|
@ -342,6 +342,9 @@ class CakeSession {
|
|||
if ($userAgent) {
|
||||
self::$_userAgent = $userAgent;
|
||||
}
|
||||
if (empty(self::$_userAgent)) {
|
||||
CakeSession::init(self::$path);
|
||||
}
|
||||
return self::$_userAgent;
|
||||
}
|
||||
|
||||
|
@ -680,7 +683,4 @@ class CakeSession {
|
|||
self::$error[$errorNumber] = $errorMessage;
|
||||
self::$lastError = $errorNumber;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize the session
|
||||
CakeSession::init();
|
||||
}
|
Loading…
Add table
Reference in a new issue