Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.9.5, 3.0.2
-
Component/s: Blocks, Navigation, Themes
-
Testing Instructions:
-
Affected Branches:MOODLE_29_STABLE, MOODLE_30_STABLE
-
Fixed Branches:MOODLE_29_STABLE, MOODLE_30_STABLE
-
Pull from Repository:
-
Pull Master Branch:
MDL-53383-master -
Pull Master Diff URL:
Description
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)) {