Skip to content

Commit

Permalink
MDL-62907 Logging: Allow nulls on info, cases have been detected
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Apr 17, 2019
1 parent 0423ed4 commit 65453b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion admin/tool/log/classes/helper/reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function get_description() {
* @param string $other Other value
* @return mixed Decoded value
*/
public static function decode_other(string $other) {
public static function decode_other(?string $other) {
if ($other === 'N;' || preg_match('~^.:~', $other)) {
return unserialize($other);
} else {
Expand Down
4 changes: 4 additions & 0 deletions admin/tool/log/store/standard/tests/store_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ public function test_decode_other($value) {
$this->assertEquals($value, \logstore_standard\log\store::decode_other(json_encode($value)));
}

public function test_decode_other_with_wrongly_encoded_contents() {
$this->assertSame(null, \logstore_standard\log\store::decode_other(null));
}

/**
* List of possible values for 'other' field.
*
Expand Down

0 comments on commit 65453b9

Please sign in to comment.