diff -u b/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php --- b/core/modules/views/src/ViewExecutable.php +++ b/core/modules/views/src/ViewExecutable.php @@ -21,6 +21,7 @@ * occurred when using the serialize method. * * @see https://www.drupal.org/node/2849674 + * @see https://bugs.php.net/bug.php?id=66052 */ class ViewExecutable { only in patch2: unchanged: --- a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php +++ b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php @@ -487,6 +487,35 @@ public function testSerialization() { $this->assertIdentical($unserialized->current_display, 'page_1', 'The expected display was set on the unserialized view.'); $this->assertIdentical($unserialized->args, ['test'], 'The expected argument was set on the unserialized view.'); $this->assertIdentical($unserialized->getCurrentPage(), 2, 'The expected current page was set on the unserialized view.'); + + // Get the definition of node's nid field, for example. Only get it not from + // the field manager directly, but from the item data definition. It should + // be the same base field definition object (the field and item definitions + // refer to each other). + // See https://bugs.php.net/bug.php?id=66052 + $field_manager = \Drupal::service('entity_field.manager'); + $nid_definition_before = $field_manager->getBaseFieldDefinitions('node')['nid'] + ->getItemDefinition() + ->getFieldDefinition(); + + // Load and execute a view. + $view_entity = View::load('content'); + $view_executable = $view_entity->getExecutable(); + $view_executable->execute('page_1'); + + // Reset static cache, but leave possibility to use database cache. + $field_manager->useCaches(FALSE); + $field_manager->useCaches(TRUE); + + // Magic line. + unserialize(serialize(['SOMETHING UNEXPECTED', $view_executable])); + + // Make sure the serialisation of the ViewExecutable didn't influence the + // field definitions. + $nid_definition_after = $field_manager->getBaseFieldDefinitions('node')['nid'] + ->getItemDefinition() + ->getFieldDefinition(); + $this->assertEquals($nid_definition_before->getPropertyDefinitions(), $nid_definition_after->getPropertyDefinitions()); } }