reverted: --- b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigField.php +++ a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigField.php @@ -72,13 +72,4 @@ return $constraints; } - /** - * Avoid to serialize the instance; unnecessary and breaks in PHP 5.4. - */ - public function __sleep() { - $vars = get_class_vars(get_class($this)); - unset($vars['instance']); - return array_keys($vars); - } - } diff -u b/core/modules/file/file.install b/core/modules/file/file.install --- b/core/modules/file/file.install +++ b/core/modules/file/file.install @@ -319,0 +320 @@ + only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/Entity/Field.php +++ b/core/modules/field/lib/Drupal/field/Entity/Field.php @@ -704,21 +704,18 @@ public function offsetUnset($offset) { } } - /** - * {@inheritdoc} - */ - public function serialize() { - // Only store the definition, not external objects or derived data. - return serialize($this->getExportProperties()); + public function __sleep() { + return array_intersect(array_keys($this->getExportProperties()), array_keys(get_object_vars($this))); } - /** - * {@inheritdoc} - */ - public function unserialize($serialized) { - $this->__construct(unserialize($serialized)); + public function __wakeup() { + // @todo array_filter() not great... + $new_obj = new static(array_filter(get_object_vars($this))); + foreach (get_object_vars($new_obj) as $key => $value) { + $this->{$key} = $value; + } } - + /** * A list of columns that can not be used as field type columns. * only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php +++ b/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php @@ -629,19 +629,16 @@ public function offsetUnset($offset) { unset($this->{$offset}); } - /** - * {@inheritdoc} - */ - public function serialize() { - // Only store the definition, not external objects or derived data. - return serialize($this->getExportProperties()); + public function __sleep() { + return array_intersect(array_keys($this->getExportProperties()), array_keys(get_object_vars($this))); } - /** - * {@inheritdoc} - */ - public function unserialize($serialized) { - $this->__construct(unserialize($serialized)); + public function __wakeup() { + // @todo array_filter() not great... + $new_obj = new static(array_filter(get_object_vars($this))); + foreach (get_object_vars($new_obj) as $key => $value) { + $this->{$key} = $value; + } } } only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/FieldInstanceInterface.php +++ b/core/modules/field/lib/Drupal/field/FieldInstanceInterface.php @@ -13,7 +13,7 @@ /** * Provides an interface defining a field instance entity. */ -interface FieldInstanceInterface extends ConfigEntityInterface, FieldDefinitionInterface, \ArrayAccess, \Serializable { +interface FieldInstanceInterface extends ConfigEntityInterface, FieldDefinitionInterface, \ArrayAccess { /** * Returns the field entity for this instance. only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/FieldInterface.php +++ b/core/modules/field/lib/Drupal/field/FieldInterface.php @@ -13,7 +13,7 @@ /** * Provides an interface defining a field entity. */ -interface FieldInterface extends ConfigEntityInterface, FieldDefinitionInterface, \ArrayAccess, \Serializable { +interface FieldInterface extends ConfigEntityInterface, FieldDefinitionInterface, \ArrayAccess { /** * Returns the field schema.