-
Bug
-
Resolution: Fixed
-
Minor
-
2.9.5, 3.0.2
-
MOODLE_29_STABLE, MOODLE_30_STABLE
-
MOODLE_29_STABLE, MOODLE_30_STABLE
-
MDL-53383-master -
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)) {