Skip to content

Fix a fatal bug in JSession and lay the groundwork for lazy sessions. #1236

Merged
merged 1 commit into from Jun 16, 2012

2 participants

@realityking
Joomla! member

No description provided.

@chdemko chdemko commented on the diff Jun 6, 2012
libraries/joomla/session/session.php
@@ -396,6 +407,20 @@ public function isNew()
}
/**
+ * Check whether this session is currently created
+ *
+ * @param JInput $input JInput object for the session to use.
+ *
+ * @return void.
+ *
+ * @since 12.2
+ */
+ public function initialise(JInput $input)
+ {
+ $this->input = $input;
+ }
@chdemko
chdemko added a note Jun 6, 2012

Why not returning $this for chaining ?

@realityking
Joomla! member
realityking added a note Jun 13, 2012

Since the rest of JSession is not chainable (and not easily made so) wouldn't that cause more confusion that utility?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@chdemko chdemko commented on the diff Jun 6, 2012
libraries/joomla/session/session.php
+ * @since 12.2
+ */
+ public function start()
+ {
+ $this->_start();
+
+ $this->_state = 'active';
+
+ // Initialise the session
+ $this->_setCounter();
+ $this->_setTimers();
+
+ // Perform security checks
+ $this->_validate();
+
+ return true;
@chdemko
chdemko added a note Jun 6, 2012

why not returning $this for chaining?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@chdemko chdemko commented on the diff Jun 6, 2012
libraries/legacy/application/application.php
@@ -958,6 +958,8 @@ protected function _createSession($name)
}
$session = JFactory::getSession($options);
+ $session->initialise($this->input);
@chdemko
chdemko added a note Jun 6, 2012

if chaining is done this could be replaced by

$session->initialise($this->input)->start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@realityking realityking JSession depends on JFactory:getApplication() returning a valid JAppl…
…icationBase object. However JApplication's constructor tries to create a JSession object which can't work.

This also lays the groundwork for lazy sessions.

Removes the destructor from JSession. We don't need it anymore since we registered session_write close as a shutdown function.
cbc570e
@chdemko chdemko merged commit aea3dd7 into joomla:staging Jun 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.