https://qa.drupal.org/pifr/test/734888
https://qa.drupal.org/8.x-status

Drupal\system\Tests\Ajax\MultiFormTest is a nice + fast test case.

drupalPostAjaxForm() shows the following fatal error in the page output of the internal browser:

Fatal error: Call to a member function getPropertyDefinitions() on a non-object
  in \core\lib\Drupal\Core\Field\TypedData\FieldItemDataDefinition.php on line 71
-
{main}( )	..\index.php:0
drupal_handle_request( )	..\index.php:15
Drupal\Core\DrupalKernel->handle( )	..\bootstrap.inc:1641
Drupal\Core\HttpKernel->handle( )	..\DrupalKernel.php:283
Symfony\Component\HttpKernel\HttpKernel->handle( )	..\HttpKernel.php:65
Symfony\Component\HttpKernel\HttpKernel->handleRaw( )	..\HttpKernel.php:66
call_user_func_array ( )	..\HttpKernel.php:126
Drupal\Core\Controller\AjaxController->content( )	..\HttpKernel.php:126
Drupal\Core\Controller\AjaxController->getContentResult( )	..\AjaxController.php:58
call_user_func_array ( )	..\AjaxController.php:82
Drupal\system\Controller\FormAjaxController->content( )	..\AjaxController.php:82
Drupal\system\Controller\FormAjaxController->getForm( )	..\FormAjaxController.php:36
form_get_cache( )	..\FormAjaxController.php:77
Drupal\Core\Form\FormBuilder->getCache( )	..\form.inc:163
Drupal\Core\KeyValueStore\StorageBase->get( )	..\FormBuilder.php:367
Drupal\Core\KeyValueStore\DatabaseStorageExpirable->getMultiple( )	..\StorageBase.php:40
array_map ( )	..\DatabaseStorageExpirable.php:70
Drupal\entity\Entity\EntityFormDisplay->unserialize( )	..\DatabaseStorageExpirable.php:0
Drupal\entity\Entity\EntityFormDisplay->__construct( )	..\EntityFormDisplay.php:164
Drupal\entity\EntityDisplayBase->__construct( )	..\EntityFormDisplay.php:118
Drupal\entity\EntityDisplayBase->init( )	..\EntityDisplayBase.php:138
Drupal\entity\EntityDisplayBase->getFieldDefinitions( )	..\EntityDisplayBase.php:223
_field_create_entity_from_ids( )	..\EntityDisplayBase.php:337
entity_create( )	..\field.module:677
Drupal\Core\Entity\FieldableEntityStorageControllerBase->create( )	..\entity.inc:365
Drupal\Core\Entity\ContentEntityBase->__construct( )	..\FieldableEntityStorageControllerBase.php:70
Drupal\Core\Entity\ContentEntityBase->setDefaultLangcode( )	..\ContentEntityBase.php:152
Drupal\Core\Entity\ContentEntityBase->get( )	..\ContentEntityBase.php:565
Drupal\Core\Entity\ContentEntityBase->getTranslatedField( )	..\ContentEntityBase.php:385
Drupal\Core\TypedData\TypedDataManager->getPropertyInstance( )	..\ContentEntityBase.php:422
Drupal\Core\TypedData\TypedDataManager->create( )	..\TypedDataManager.php:276
Drupal\Core\TypedData\TypedDataManager->createInstance( )	..\TypedDataManager.php:128
Drupal\Core\Field\FieldItemList->__construct( )	..\TypedDataManager.php:89
Drupal\Core\TypedData\Plugin\DataType\ItemList->createItem( )	..\FieldItemList.php:50
Drupal\Core\TypedData\TypedDataManager->getPropertyInstance( )	..\ItemList.php:172
Drupal\Core\TypedData\TypedDataManager->create( )	..\TypedDataManager.php:276
Drupal\Core\TypedData\TypedDataManager->createInstance( )	..\TypedDataManager.php:128
Drupal\Core\Field\FieldItemBase->__construct( )	..\TypedDataManager.php:89
Drupal\Core\Field\TypedData\FieldItemDataDefinition->getPropertyDefinitions( )	..\FieldItemBase.php:40
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Issue summary: View changes

Drupal\system\Tests\Ajax\MultiFormTest is a nice + fast test case.

Berdir’s picture

Berdir’s picture

Status: Active » Needs review
FileSize
1.52 KB

Grr.

\Serializable in PHP 5.4 is seriously messed up.

I have no idea what is exactly going on, but this seems to be working for me?!

fago’s picture

I don't think that code stems from #2002134: Move TypedData metadata introspection from data objects to definition objects, but it might have triggered the problem. #3 looks good to me

swentel’s picture

We'v had this in Field API config conversion too - see #2074253: Fatal error when using Serializable interface on PHP 5.4

sun’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
1.56 KB

I noticed this mismatch in the inheritance chain, but changing it did not resolve it.

class EntityFormDisplay extends EntityDisplayBase implements EntityFormDisplayInterface, \Serializable {
  public function serialize() {
  public function unserialize($serialized) {
↓
abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDisplayInterface {
↓
abstract class ConfigEntityBase extends Entity implements ConfigEntityInterface {
↓
abstract class Entity implements EntityInterface {
  public function __sleep() {

I also noticed a seemingly unintended self:: instead of static:: call to create() in DataDefinition, but changing that did not help either.

The patch in #3, however, passes for me locally.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Okay patch in #3 is committed d1bbfa7 and pushed to 8.x. Thanks!

Status: Fixed » Needs work

The last submitted patch, 3: stupid-php-2205367-3.patch, failed testing.

sun’s picture

Status: Needs work » Fixed
yched’s picture

For consistency, the __sleep() / __wakeup() should be added to EntityViewDisplay too.
Then this very same code is duplicated in 4 different config entity classes.

--> Revived #1977206: Default serialization of ConfigEntities.
Content entities have default serialization code in ContentEntityBase now, config entities should have theirs too.

swentel’s picture

So this broke #2210873: Let plugin bags use the DependencySerializationTrait (was: EditorAdminTest fails on PHP 5.4 silently with unicorn editor) - but very silently, possibly depending on 5.4.X version as it's not catched by the bot.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.