Skip to content

Loading…

JSession still uses JRequest #1180

Merged
merged 4 commits into from

3 participants

@florianv

It causes a fatal error when instanciating JSession because _start() still uses JRequest. I don't know if you want to use this construction

@realityking realityking commented on an outdated diff
libraries/joomla/session/session.php
((13 lines not shown))
{
- if (JRequest::getVar($session_name))
+ if ($session_clean = $input->get($session_name, false, 'string'))
@realityking Joomla! member

Please don't make assignments inside conditionals. We want to move away from that kind of style since it's a source of bugs and confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@realityking
Joomla! member

Otherwise looks good, will test with the CMS after the adjustment is made.

@florianv

Thanks for the feedback. I didn't find an efficient way to test it

@realityking
Joomla! member

Thanks for the fix. You now have a code style error on line 534 (whitespace at the end of a line)

@florianv

I think Eclipse adds it, found a plugin that should remove it, I hope it works

@chdemko chdemko merged commit 0df15e3 into joomla:staging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 2, 2012
  1. @florianv

    JSession still uses JRequest

    florianv committed
  2. @florianv

    JSession typo

    florianv committed
Commits on May 3, 2012
  1. @florianv

    JSession adjustement

    florianv committed
  2. @florianv

    JSession whitespace

    florianv committed
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 6 deletions.
  1. +13 −6 libraries/joomla/session/session.php
View
19 libraries/joomla/session/session.php
@@ -9,8 +9,6 @@
defined('JPATH_PLATFORM') or die;
-jimport('joomla.environment.request');
-
/**
* Class for managing HTTP sessions
*
@@ -523,12 +521,21 @@ protected function _start()
else
{
$session_name = session_name();
- if (!JRequest::getVar($session_name, false, 'COOKIE'))
+
+ // Get the JInput object
+ $input = JFactory::getApplication()->input;
+
+ // Get the JInputCookie object
+ $cookie = $input->cookie;
+
+ if (is_null($cookie->get($session_name)))
{
- if (JRequest::getVar($session_name))
+ $session_clean = $input->get($session_name, false, 'string');
+
+ if ($session_clean)
{
- session_id(JRequest::getVar($session_name));
- setcookie($session_name, '', time() - 3600);
+ session_id($session_clean);
+ $cookie->set($session_name, '', time() - 3600);
}
}
}
Something went wrong with that request. Please try again.