Summary

a bug in JApplication::getUserStateFromRequest in /libraries/joomla/application/application.php

The $default parameter is ignored when getting the variable from $_REQUEST.

The third line of the function above should be changed as follows:
>>>replace this>>>
$new_state = JRequest::getVar($request, null, 'default', $type);
>>>with this>>>
$new_state = JRequest::getVar($request, $default, 'default', $type);
Opened On:
6 Mar 2013, 13:55 by Vasilij Pupkin
Closed On:
10 Aug 2013, 4:22
Status:
Closed

Filed Under

  • Apache 2.2.x
  • Developer
  • MySQL 5.2.x
  • PHP 5.3.x

Responses

Posted on 3 Aug 2013, 13:16 by Jonny Roger
Hi,

I'm not sure that this is a bug.

Currently: It returns $old_state if no new state in request - i.e. no change in state (same old state). And if there is no $old_state, it returns the $default. That seems pretty reasonable.

With your proposed change: It would go against the "Save the new value only if it was set in this request" by changing the state to the $default if there is no new state in request. So, the function should actually then be called "setUserStateFromRequest" instead of "getUserStateFromRequest" :)

What you propose was done similarly in older file versions and was changed here: https://joomlacode.org/gf/project/joomla/scmsvn/?action=browse&path=%2F&view=rev&revision=7596