-
Bug
-
Resolution: Fixed
-
Major
-
3.7.7, 3.8.4, 3.9.1
-
MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
-
MOODLE_38_STABLE, MOODLE_39_STABLE
-
-
With developer debugging on templates that have string declarations spread over multiple lines fail to load correctly.
Steps to reproduce
Assumptions
- A forum with at least one post with the following settings required:
- Whole forum grading > Grade: Point
- Developer debug is turned on
- Display debug messages is on
Steps
- Navigate to the forum
- Press the Grade users button
At this point there will be an TypeError exception with a message like Cannot read property 'stack' on 'Internal Server Error'
Looking at the Network traffic for the page you will be able to see that a call to the core_output_load_template web service returned:
Debugging: Invalid get_string() identifier: '' or component 'core'. Perhaps you are missing $string[''] = ''; in lang/en/core.php? in
|
* line 353 of \lib\classes\string_manager_standard.php: call to debugging()
|
* line 207 of \lib\classes\output\mustache_template_source_loader.php: call to core_string_manager_standard->get_string()
|
* line 182 of \lib\classes\output\mustache_template_source_loader.php: call to core\output\mustache_template_source_loader->core\output\{closure}()
|
* line 210 of \lib\classes\output\mustache_template_source_loader.php: call to core\output\mustache_template_source_loader->core\output\{closure}()
|
* line 232 of \lib\classes\output\mustache_template_source_loader.php: call to core\output\mustache_template_source_loader->load_with_dependencies()
|
* line 182 of \lib\classes\output\mustache_template_source_loader.php: call to core\output\mustache_template_source_loader->core\output\{closure}()
|
* line 254 of \lib\classes\output\mustache_template_source_loader.php: call to core\output\mustache_template_source_loader->core\output\{closure}()
|
* line 152 of \lib\classes\output\external.php: call to core\output\mustache_template_source_loader->load_with_dependencies()
|
* line 261 of \lib\externallib.php: call to core\output\external::load_template_with_dependencies()
|
* line 81 of \lib\ajax\service.php: call to external_api::call_external_function()
|
* line 33 of \lib\ajax\service-nologin.php: call to require_once()
|
I managed to track it to the a multiline string declaration
It appears to be because the preloader assumes that the next token will be the string name, when in this case the next token is a new line; the actual string identifiers are in fact part of the +2 token.
So the pre-loader attempts to load a string with an identifier of '' and a components of 'core' which fails.
The following scenarios would all fail
Correct string name; wrong component (will always be core):
{{#str}} string,
|
component {{/str}}
|
Will not find string or component correctly:
{{#str}}
|
string, component
|
{{/str}}
|
{{#str}}
|
string,
|
component
|
{{/str}}
|
- will help resolve
-
MDL-69971 Fix problems reported in apache logs before 3.10 release
- Closed