MDL-60653 Navigation: Fixed loose string comparison.
authorTyler Bannister <tyler.bannister@remote-learner.net>
Wed, 1 Nov 2017 17:24:06 +0000 (13:24 -0400)
committerShamim Rezaie <shamim@moodle.com>
Tue, 12 Dec 2017 04:32:27 +0000 (12:32 +0800)
The previous comparison would sometimes evaluate to true when the
navigation key was not a string.

lib/navigationlib.php

index 9f22f18..22e00b4 100644 (file)
@@ -434,7 +434,7 @@ class navigation_node implements renderable {
     public function build_flat_navigation_list(flat_navigation $nodes, $showdivider = false) {
         if ($this->showinflatnavigation) {
             $indent = 0;
-            if ($this->type == self::TYPE_COURSE || $this->key == self::COURSE_INDEX_PAGE) {
+            if ($this->type == self::TYPE_COURSE || $this->key === self::COURSE_INDEX_PAGE) {
                 $indent = 1;
             }
             $flat = new flat_navigation_node($this, $indent);