mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-62907 Logging: Allow nulls on info, cases have been detected
This commit is contained in:
parent
0423ed4a0f
commit
65453b9861
@ -73,7 +73,7 @@ trait reader {
|
||||
* @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 {
|
||||
|
@ -374,6 +374,10 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
$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.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user