Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-53383

navigation_node_collection -> remove function does not work without $type argument

XMLWordPrintable

      This seems broken to me .... I think?

      > public function get($key, $type=null)

      This function will get the data by key, whatever the type is, if you pass null for $type. All great!

      > public function remove($key, $type=null) {

      If you pass null for $type, this will fail to remove the object!

      Worse, it will report the removal as a success by returning true! (I assume that's the point of the "return true"?)

      The culprit seems to be this line in the remove function.

      > if ($node->key === $key && $node->type == $type) {

      This forcibly checks the type, even if you passed null! Shouldn't it be something like:

      > if ($node->key === $key && (is_null($type) || $node->type == $type)) {

            Unassigned Unassigned
            ShelterJames ShelterJames
            Andrew Lyons Andrew Lyons
            Dan Poltawski Dan Poltawski
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.