diff --git a/core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php b/core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php index 7cf9139..b279d4c 100644 --- a/core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php +++ b/core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php @@ -98,11 +98,10 @@ public function setIfNotExists($key, $value) { ->insertFields(array( 'collection' => $this->collection, 'name' => $key, - 'value' => $value, + 'value' => serialize($value), )) ->condition('collection', $this->collection) ->condition('name', $key) - ->condition('value', $value) ->execute(); return $result == Merge::STATUS_INSERT; } diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php index 771cb42..7320a74 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php @@ -981,8 +981,8 @@ public static function randomName($length = 8) { public static function randomObject($size = 4) { $object = new \stdClass(); for ($i = 0; $i < $size; $i++) { - $random_key = $this->randomName(); - $random_value = $this->randomString(); + $random_key = self::randomName(); + $random_value = self::randomString(); $object->{$random_key} = $random_value; } return $object;