-
Bug
-
Resolution: Deferred
-
Minor
-
None
-
3.1.13, 3.2.9, 3.3.6, 3.4.4, 3.5.1, 3.6
-
None
-
MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
Reviewing MDL-61238 and looking for some historic issues like MDL-18582 or MDLSITE-2716 that leaded to current coding style:
https://docs.moodle.org/dev/Coding_style#Require_.2F_include
"For library files in normal usage, require_once should be used (this is different from config.php which should always use 'require' as above)"
This about to add a new sniff to the codechecker ensuring that the correct require() alternative is used when including config.php
We already look for its inclusion in the MoodleInternalSniff but both are allowed there. Surely better to create a separate Sniff to make it a separate error.
Also, docs should be changed everywhere, right now the incorrect require_once(config.php) is ubiquitous (but coding style page).
Current (quick grep) occurrences are incorrect require_once => 36000 vs correct require => 18000. This is not about to changing all them but about to prevent new ones and progressively go reducing the incorrect ones.
Ciao
- has been marked as being related by
-
MDL-61238 Cohort administration pages require, not require_once, /cohort/lib.php
- Closed
-
MDLSITE-2716 Coding style: require/include description does not mention require_once.
- Resolved