diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
index ab2fb10..ddf4e99 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
@@ -197,7 +197,9 @@ public function disable() {
    * {@inheritdoc}
    */
   public function setStatus($status) {
-    $this->status = (bool) $status;
+    if ($status_key = $this->getEntityType()->getKey('status')) {
+      $this->{$status_key} = (bool) $status;
+    }
     return $this;
   }
 
@@ -205,7 +207,8 @@ public function setStatus($status) {
    * {@inheritdoc}
    */
   public function status() {
-    return !empty($this->status);
+    $status_key = $this->getEntityType()->getKey('status');
+    return $status_key && !empty($this->{$status_key});
   }
 
   /**
@@ -253,13 +256,20 @@ public function createDuplicate() {
    * Helper callback for uasort() to sort configuration entities by weight and label.
    */
   public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {
-    $a_weight = isset($a->weight) ? $a->weight : 0;
-    $b_weight = isset($b->weight) ? $b->weight : 0;
-    if ($a_weight == $b_weight) {
-      $a_label = $a->label();
-      $b_label = $b->label();
-      return strnatcasecmp($a_label, $b_label);
+    $entity_type = $a->getEntityType();
+    if ($entity_type->hasKey('weight')) {
+      $weight_key = $entity_type->getKey('weight');
+      $a_weight = isset($a->{$weight_key}) ? $a->{$weight_key} : 0;
+      $b_weight = isset($b->{$weight_key}) ? $b->{$weight_key} : 0;
     }
+    else {
+      $a_weight = $b_weight = 0;
+    }
+
+    if ($a_weight == $b_weight) {
+      return strnatcasecmp($a->label(), $b->label());
+    }
+
     return ($a_weight < $b_weight) ? -1 : 1;
   }
 
diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php
index 2a4b199..2fe6a9c 100644
--- a/core/lib/Drupal/Core/Entity/Entity.php
+++ b/core/lib/Drupal/Core/Entity/Entity.php
@@ -99,7 +99,8 @@ protected function uuidGenerator() {
    * {@inheritdoc}
    */
   public function id() {
-    return isset($this->id) ? $this->id : NULL;
+    $id_key = $this->getEntityType()->getKey('id');
+    return $id_key && isset($this->{$id_key}) ? $this->{$id_key} : NULL;
   }
 
   /**
diff --git a/core/modules/block/src/Entity/Block.php b/core/modules/block/src/Entity/Block.php
index 8a65843..ee70a56 100644
--- a/core/modules/block/src/Entity/Block.php
+++ b/core/modules/block/src/Entity/Block.php
@@ -33,7 +33,8 @@
  *   },
  *   admin_permission = "administer blocks",
  *   entity_keys = {
- *     "id" = "id"
+ *     "id" = "id",
+ *     "status" = "status",
  *   },
  *   links = {
  *     "delete-form" = "/admin/structure/block/manage/{block}/delete",
diff --git a/core/modules/config/src/Tests/ConfigEntityListTest.php b/core/modules/config/src/Tests/ConfigEntityListTest.php
index 9b74a5f..28a4eb7 100644
--- a/core/modules/config/src/Tests/ConfigEntityListTest.php
+++ b/core/modules/config/src/Tests/ConfigEntityListTest.php
@@ -119,7 +119,7 @@ function testList() {
     ));
     $entity->save();
     $list = $controller->load();
-    $this->assertIdentical(array_keys($list), array('beta', 'dotted.default', 'alpha', 'omega'));
+    $this->assertIdentical(array_keys($list), array('alpha', 'beta', 'dotted.default', 'omega'));
 
     // Test that config entities that do not support status, do not have
     // enable/disable operations.
@@ -209,7 +209,7 @@ function testListUI() {
 
     // Edit the entity using the operations link.
     $this->assertLinkByHref('admin/structure/config_test/manage/antelope');
-    $this->clickLink('Edit', 1);
+    $this->clickLink('Edit', 0);
     $this->assertResponse(200);
     $this->assertTitle('Edit Antelope | Drupal');
     $edit = array('label' => 'Albatross', 'id' => 'albatross');
@@ -223,7 +223,7 @@ function testListUI() {
 
     // Delete the added entity using the operations link.
     $this->assertLinkByHref('admin/structure/config_test/manage/albatross/delete');
-    $this->clickLink('Delete', 1);
+    $this->clickLink('Delete', 0);
     $this->assertResponse(200);
     $this->assertTitle('Are you sure you want to delete the test configuration Albatross? | Drupal');
     $this->drupalPostForm(NULL, array(), t('Delete'));
diff --git a/core/modules/search/src/SearchPageRepository.php b/core/modules/search/src/SearchPageRepository.php
index 66f7bda..17dd363 100644
--- a/core/modules/search/src/SearchPageRepository.php
+++ b/core/modules/search/src/SearchPageRepository.php
@@ -110,7 +110,9 @@ public function setDefaultSearchPage(SearchPageInterface $search_page) {
    */
   public function sortSearchPages($search_pages) {
     $entity_type = $this->storage->getEntityType();
-    uasort($search_pages, array($entity_type->getClass(), 'sort'));
+    // Suppress errors because PHPUnit will indirectly modify the contents,
+    // triggering https://bugs.php.net/bug.php?id=50688.
+    @uasort($search_pages, array($entity_type->getClass(), 'sort'));
     return $search_pages;
   }
 
diff --git a/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php b/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php
index 767a81b..8cac4fd 100644
--- a/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php
+++ b/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\Tests\search\Unit;
 
+use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\search\Entity\SearchPage;
 use Drupal\search\SearchPageRepository;
 use Drupal\Tests\UnitTestCase;
@@ -256,6 +258,13 @@ public function testSortSearchPages() {
       ->method('getEntityType')
       ->will($this->returnValue($entity_type));
 
+    $entity_manager = $this->prophesize(EntityManagerInterface::class);
+    $entity_manager->getDefinition('search_page')->willReturn($entity_type);
+
+    $container = new ContainerBuilder();
+    $container->set('entity.manager', $entity_manager->reveal());
+    \Drupal::setContainer($container);
+
     // Declare entities out of their expected order so we can be sure they were
     // sorted. We cannot mock these because of uasort(), see
     // https://bugs.php.net/bug.php?id=50688.
@@ -274,9 +283,7 @@ public function testSortSearchPages() {
 
 class TestSearchPage extends SearchPage {
   public function __construct(array $values) {
-    foreach ($values as $key => $value) {
-      $this->$key = $value;
-    }
+    parent::__construct($values, 'search_page');
   }
   public function label($langcode = NULL) {
     return $this->label;
