Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
3.0.3
-
None
-
MOODLE_30_STABLE
-
Easy
Description
In file moodle/lib/navigationlib.php at line 1592 there is a expression
(($category->type != self::TYPE_CATEGORY) || ($category->type != self::TYPE_MY_CATEGORY)) |
But it is always true:
if $category->type is self::TYPE_CATEGORY then ($category->type != self::TYPE_CATEGORY) is true, so whole expression is true
if $category->type is self::TYPE_MY_CATEGORY then ($category->type != self::TYPE_MY_CATEGORY) is true, so whole expression is true
if $category->type is SOME_ANOTHER_TYPE then ($category->type != self::TYPE_CATEGORY) is true, so whole expression is true
Probably, you should use "&&" operator instead of "||"
GitHub link: https://github.com/moodle/moodle/blob/b611ade3abc7f19341db866a2d9c31f53909ba8e/lib/navigationlib.php#L1591
The possible defect was found by static analyzer AppChecker