Notice: Undefined index: month in moodle\lib\form\dateselector.php

Re: Notice: Undefined index: month in moodle\lib\form\dateselector.php

- Tatsuya Shirai の投稿
返信数: 0

 報告が遅れていました.
 上記私の修正方法はナンセンスで効果のない物でした.失礼しました.

 より正しい修正方法がHubert Chati氏により示されており,私もその方法について調査を行い,同意見となりました.ただ,yearとdayも(int)でキャスティングする必要はありませんので,それは副作用を最小にした方が良いと考えるのであれば止めた方が良いでしょう.

moodle/lib/form/dateselector.phpの function onQuickFormEvent()のcase 'updateValue'の中ほど.

                if (!is_array($value)) {
                    $currentdate = usergetdate($value);
                    $value = array(
                        'day' => $currentdate['mday'],
//                      'month' => $currentdate['mon'],
                        'month' => (int)$currentdate['mon'],
                        'year' => $currentdate['year']);
                    // If optional, default to off, unless a date was provided
                     if($this->_options['optional']) {
                        $value['off'] = ($requestvalue == 0) ? true : false;
                    }
                } else {