- πΊπΈUnited States smustgrave
Since there hasn't been a follow up to #9 going to close for now.
If still a bug please reopen addressing #9
Thanks all!
- Merge request !8394[warning] array_flip(): Can only flip STRING and INTEGER values, when saving a non-revisionable custom content entity β (Closed) created by efpapado
- Status changed to Needs review
6 months ago 8:04am 13 June 2024 - π³π΄Norway efpapado
Reopening the issue since the problem is still here on D10.2.3.
This is the relevant part of the stacktrace:
EntityChangesDetectionTrait.php:34, Drupal\Core\Entity\ContentEntityBase->traitGetFieldsToSkipFromTranslationChangesCheck() ContentEntityBase.php:1434, Drupal\Core\Entity\ContentEntityBase->getFieldsToSkipFromTranslationChangesCheck() ContentEntityBase.php:1475, Drupal\Core\Entity\ContentEntityBase->hasTranslationChanges() ChangedItem.php:49, Drupal\Core\Field\Plugin\Field\FieldType\ChangedItem->preSave() FieldItemList.php:233, Drupal\Core\Field\FieldItemList->delegateMethod() FieldItemList.php:191, Drupal\Core\Field\FieldItemList->preSave() ContentEntityStorageBase.php:938, Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldMethod() ContentEntityStorageBase.php:888, Drupal\Core\Entity\ContentEntityStorageBase->invokeHook() EntityStorageBase.php:529, Drupal\Core\Entity\EntityStorageBase->doPreSave() ContentEntityStorageBase.php:753, Drupal\Core\Entity\ContentEntityStorageBase->doPreSave() EntityStorageBase.php:483, Drupal\Core\Entity\EntityStorageBase->save() SqlContentEntityStorage.php:806, Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() EntityBase.php:352, Drupal\Core\Entity\EntityBase->save() ...
@larowlan
Looking at \Drupal\Core\Entity\ContentEntityStorageBase::populateAffectedRevisionTranslations which I think would be the calling parent here, can you check if it gets inside the if statement
if ($this->entityType->isTranslatable() && $this->entityType->isRevisionable()) {
I suspect it should not, so you might need to check those two methods.
Up until the array_flip that throws the warning, the
\Drupal\Core\Entity\ContentEntityStorageBase::populateAffectedRevisionTranslations
is not called at all.I created a merge request.
- Merge request !8395Prevent warning on array_flip() that is passed array with boolean values. β (Open) created by efpapado
- π³π΄Norway efpapado
Hiding the patch file, as a MR has now been used, and changing the version to 11.x
- Status changed to Needs work
6 months ago 3:55pm 18 June 2024 - πΊπΈUnited States smustgrave
This may count as not needing tests but think should least include a comment for the change.
- Status changed to Needs review
6 months ago 11:37am 19 June 2024 - Status changed to RTBC
6 months ago 9:53pm 19 June 2024 - πΊπΈUnited States smustgrave
Going to lean on this being small enough to not need test coverage so will mark.
- Status changed to Needs work
6 months ago 10:16pm 19 June 2024 - π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
I feel this one is valid enough to add tests for.
\Drupal\entity_test\Entity\EntityTest in core only has a base table, no data table etc.