-
Bug
-
Resolution: Fixed
-
Major
-
2.9.5, 3.0.3
-
MySQL
-
MOODLE_29_STABLE, MOODLE_30_STABLE
-
MOODLE_29_STABLE, MOODLE_30_STABLE
-
wip-mdl-53701
-
Pre-Requisites :
1. Log in as admin .
2. Navigate to any course->Edit settings
2.2. Change language of the page to DE or FR or RU or AR or ES or ES_ES
3. Verify that call to M.form.dateselector.init_date_selectors() have something in parameters (and then don't throw the uncaught exception : Cannot read property 'firstdayofweek' of undefined.
Problem localized:
In the PHP file \moodle\lib\formslib.php line 76, there is function form_init_date_js()
Comparing the source code with a working one, I've pointed a difference in the way $config is populated:
No bug (Moodle 3.0):
'mon' => date_format_string(strtotime("Monday"), '%a', 99),
With bug (Moodle 2.9 build 20160324):
'mon' => strftime('%a', strtotime("Monday")),
The bug was solved by taking the 3.0 source code and put it instead 2.9 source code.
It's a regression introduced by the last commit on this file for (MDL-52978): https://github.com/moodle/moodle/commit/197f99a80863182cfac2bfab7e109774af23b1d5
Hi,
We have two Moodle sites (2.9.5+) running automated update every week (wed. morning).
One is in build: 20160324, the other is in build 20160331.
Both have the same javascript uncaught error at least since the update to the build 20160324, but maybe sooner.
I'm not 100% sure if this bug is a regression introduced by a build or is only related to our configuration somehow. I doubt because it's curious that it hasn't be reported yet but I see nothing we've done that can break YUI?
Here is the error and how it happened:
Which pages: the edition page of any course (ex: /course/edit.php?id=36).
EDIT: also in the edition of modules parameters like: /course/modedit.php?update=91342&return=1
Which JS error: Uncaught TypeError: Cannot read property 'firstdayofweek' of undefined
Which JS file: dateselector-min.js, line 84
What happens: The error is triggered when an allowed user opens the edition page of a course with some particular languages settings (FR, ES,...). The file uploader in the Description section loops on "loading" and the collapse/uncollapse arrows of sections below do not appears because of the uncatched error (see the screenshot attached).
What I do: First, I replaced dateselector-min.js with dateselector-debug.js.
The error is localized in function init_date_selectors, where config is null and shouldn't be. config is supposed to be the only argument of the function:
init_date_selectors: function(config) {
...
I looked after the call of the function in the HTML page: I found this:
Y.use("moodle-form-dateselector",function()
);
Looks like config is missing as an argument of init_date_selectors() ?
As a quick and dirty fix, I've add a return; in the begginning of the function init_date_selectors if config is null but I guess it should trigger errors somewhere else. I cannot look deeper in the code as I don't know a thing about YUI.