{"action":"opened","issue":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/8859","labels_url":"https://api.github.com/repos/joomla/joomla-cms/issues/8859/labels{/name}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/8859/comments","events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/8859/events","html_url":"https://github.com/joomla/joomla-cms/issues/8859","id":125616415,"number":8859,"title":"JFactory::getSession()->set() no longer working according to docs","user":{"login":"OctavianC","id":1422378,"avatar_url":"https://avatars.githubusercontent.com/u/1422378?v=3","gravatar_id":"","url":"https://api.github.com/users/OctavianC","html_url":"https://github.com/OctavianC","followers_url":"https://api.github.com/users/OctavianC/followers","following_url":"https://api.github.com/users/OctavianC/following{/other_user}","gists_url":"https://api.github.com/users/OctavianC/gists{/gist_id}","starred_url":"https://api.github.com/users/OctavianC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OctavianC/subscriptions","organizations_url":"https://api.github.com/users/OctavianC/orgs","repos_url":"https://api.github.com/users/OctavianC/repos","events_url":"https://api.github.com/users/OctavianC/events{/privacy}","received_events_url":"https://api.github.com/users/OctavianC/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-08T13:50:23Z","updated_at":"2016-01-08T13:50:23Z","closed_at":null,"body":"# Problem\r\nAccording to `libraries/joomla/session.php`, the function `set()` should return the old value of the variable:\r\n```php\r\n/**\r\n\t * Set data into the session store.\r\n\t *\r\n\t * @param   string  $name       Name of a variable.\r\n\t * @param   mixed   $value      Value of a variable.\r\n\t * @param   string  $namespace  Namespace to use, default to 'default'.\r\n\t *\r\n\t * @return  mixed  Old value of a variable.\r\n\t *\r\n\t * @since   11.1\r\n\t */\r\n\tpublic function set($name, $value = null, $namespace = 'default')\r\n```\r\n\r\nThis is no longer working and I'm guessing since the hardening patch was introduced.\r\n\r\n# Test instructions\r\nTested with Joomla! 3.4.8, haven't had a chance to test the staging branch just yet.\r\nRun the following code:\r\n```php\r\n$session = JFactory::getSession();\r\n$session->set('test', 1);\r\necho $session->set('test', 2);\r\n```\r\n## Expected result:\r\n```\r\n1\r\n```\r\n\r\n## Actual result:\r\n```\r\n2\r\n```\r\n\r\nAs you can see, it no longer returns the old value, it will return the current (set) value instead."}}