Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Cannot Reproduce
-
Affects Version/s: 1.9.7
-
Fix Version/s: None
-
Component/s: Administration
-
Labels:None
-
Affected Branches:MOODLE_19_STABLE
Description
Site administratoration - Users - Accounts - Browse list of users
When we search a user by setting on any condition in filter form, we will get a notice message as following;
Notice: Undefined index: month in C:\xampplite\htdocs\moodle\lib\form\dateselector.php
The cause of this notice is inconsistency of values between prepared values for pull-down menu and initial setting value (= current date).
Prepared values of array is "1, 2, 3, 4, 5, 6, ..., 12".(strings),
initial setting value of month (=$currentdata['mon']) base on following code in function onQuickFormEvent() of lib/form/dateselector.php is "03," (=March, string(2))
$currentdate = usergetdate($value);
We can solve this problem by changing only one statement as follows.
$requestvalue=$value;
if ($value == 0)
if (!is_array($value)) {
// $currentdate = usergetdate($value);
$currentdate = usergetdate($value, "%B");
$value = array(
'day' => $currentdate['mday'],
'month' => $currentdate['mon'],
'year' => $currentdate['year']);
// If optional, default to off, unless a date was provided
if($this->_options['optional'])
$currentdate['mon'] will be changed "03"(string(2)) to 3(int) by adding argument "%B".
Since the prepared list of month are generated in function _createElements() as follows;
function _createElements()
{
$this->_elements = array();
for ($i=1; $i<=31; $i++)
for ($i=1; $i<=12; $i++)
{ $months[$i] = userdate(gmmktime(12,0,0,$i,15,2000), "%B"); }for ($i=$this->_options['startyear']; $i<=$this->_options['stopyear']; $i++)
{ $years[$i] = $i; }by using function userdate() with "%B" argument.
Attachments
Issue Links
- is duplicated by
-
MDL-27216 Undefined index: month in /var/www/vhosts/shared/moodle/19/lib/form/dateselector.php on line 206
-
- Closed
-