Problem/Motivation

I've just migrated a site from version 9.5.11 to 10.3.5 and everything went fine, except that I'm having a problem updating some fields which are all of type Entity Reference -> views reference. With drush upe --show, I can see my 3 upgradable entities:

vmeso@vmeso:~/htdocs/esod10$ drush upe --show

 -> node. Change(s) : 3

    The field node.field_contact_project_search needs to be updated.

    Field node.field_pub_anr needs to be updated.

    The field node.field_publications_member_eso needs to be updated.

    -> Entity type 'node' is updatable.

    -> Use: drush upe node

But when I apply: drush upe node, I get the following message:

[warning] array_flip(): Can only flip string and integer values, entry skipped SqlContentEntityStorageSchema.php:2476
 [warning] array_flip(): Can only flip string and integer values, entry skipped SqlContentEntityStorageSchema.php:2476
 [warning] Undefined array key "node__field_contact_projet_recherche" SqlContentEntityStorageSchema.php:2479
 [warning] Trying to access array offset on null SqlContentEntityStorageSchema.php:2479
 [warning] Trying to access array offset on null SqlContentEntityStorageSchema.php:2479
[error]  TypeError: array_intersect_key(): Argument #1 ($array) must be of type array, null given in array_intersect_key() (line 2479 of /home/vmeso/htdocs/esod10/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php) #0 /home/vmeso/htdocs/esod10/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php(2479): array_intersect_key()
#1 /home/vmeso/htdocs/esod10/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php(1749): Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->hasColumnChanges()
#2 /home/vmeso/htdocs/esod10/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php(1529): Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->updateDedicatedTableSchema()
#3 /home/vmeso/htdocs/esod10/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php(703): Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->performFieldSchemaOperation()
#4 /home/vmeso/htdocs/esod10/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1552): Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onFieldStorageDefinitionUpdate()
#5 /home/vmeso/htdocs/esod10/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1597): Drupal\Core\Entity\Sql\SqlContentEntityStorage->Drupal\Core\Entity\Sql\{closure}()
#6 /home/vmeso/htdocs/esod10/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1551): Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException()
#7 /home/vmeso/htdocs/esod10/core/lib/Drupal/Core/Field/FieldStorageDefinitionListener.php(104): Drupal\Core\Entity\Sql\SqlContentEntityStorage->onFieldStorageDefinitionUpdate()
#8 /home/vmeso/htdocs/esod10/modules/contrib/devel_entity_updates/src/DevelEntityDefinitionUpdateManager.php(199): Drupal\Core\Field\FieldStorageDefinitionListener->onFieldStorageDefinitionUpdate()
#9 /home/vmeso/htdocs/esod10/modules/contrib/devel_entity_updates/src/DevelEntityDefinitionUpdateManager.php(143): Drupal\devel_entity_updates\DevelEntityDefinitionUpdateManager->doFieldUpdate()
#10 /home/vmeso/htdocs/esod10/modules/contrib/devel_entity_updates/src/Commands/DevelEntityUpdatesCommands.php(104): Drupal\devel_entity_updates\DevelEntityDefinitionUpdateManager->applyUpdates()
#11 /home/vmeso/htdocs/esod10/modules/contrib/devel_entity_updates/src/Commands/DevelEntityUpdatesCommands.php(65): Drupal\devel_entity_updates\Commands\DevelEntityUpdatesCommands->doEntityUpdates()
#12 [internal function]: Drupal\devel_entity_updates\Commands\DevelEntityUpdatesCommands->entityUpdates()
#13 /home/vmeso/htdocs/esod10/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#14 /home/vmeso/htdocs/esod10/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#15 /home/vmeso/htdocs/esod10/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#16 /home/vmeso/htdocs/esod10/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process()
#17 /home/vmeso/htdocs/esod10/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#18 /home/vmeso/htdocs/esod10/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run()
#19 /home/vmeso/htdocs/esod10/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#20 /home/vmeso/htdocs/esod10/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#21 /home/vmeso/htdocs/esod10/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
#22 /home/vmeso/htdocs/esod10/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#23 /home/vmeso/htdocs/esod10/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
#24 /home/vmeso/htdocs/esod10/vendor/drush/drush/drush(4): require('...')
#25 {main}. 
TypeError: array_intersect_key(): Argument #1 ($array) must be of type array, null given in /home/vmeso/htdocs/esod10/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php on line 2479 #0 /home/vmeso/htdocs/esod10/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php(2479): array_intersect_key()

I've tried to empty the contents of the nodes in question, but nothing works, and the database schema cannot be updated for these fields.

I've tried with drush updatedb, and nothing, in fact, i have this message :
PHP Fatal error: Declaration of Consolidation\Log\LoggerManager::log($level, Stringable|string $message, array $context = []): void must be compatible with Psr\Log\LoggerInterface::log($level, $message, array $context = []) in /home/vmeso/htdocs/esod10/vendor/consolidation/log/src/LoggerManager.php on line 146. I think it's an another problem, not connected with the first.

Steps to reproduce

Difficult : migrate d9 to d10 with a content type in which there is an Entity Reference field to a view that must return a list of publications based on a condition (an author identifier). Works fine under D9, but... not after migration

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

    Comments

    sdj created an issue. See original summary.

    sdj’s picture

    Title: TypeError: array_intersect_key(): Argument #1 ($array) must be of type array, null given in array_intersect_key() (line 2479 of /home/vmeso/htdocs/esod10/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php) #0 /core/ » TypeError: array_intersect_key(): Argument #1 ($array) must be of type array, null given in array_intersect_key() (line 2479 of /core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php) #0
    Issue summary: View changes
    cilefen’s picture

    Category: Bug report » Support request
    Issue tags: -entity, -storage, -updates +Needs steps to reproduce

    I am marking this as a support request until we have steps to reproduce.

    Which module provides drush upe? If that module is the problem we should move this issue there.

    The Declaration of Consolidation\Log\LoggerManager is, I think, a classic problem with upgrading Drush. What is the Drush version and how exactly are you executing Drush? You should search around for that error.

    sdj’s picture

    Many thanks for answer.

    drush upe is a method linked to Entity Update.
    I also tested with Devel Entity Update (drush entup) and got the same result.

    I think the problem comes from Views Reference, as the three fields I can't update are of this type. I'm also looking at Views Reference, because the 3 fields causing the problem are of views reference type. When I try to modify these fields, and I want, for example, to set a default parameter (an Entity Reference view and display), I get the following error when I save:

    AH01071: Got error ‘PHP message: Uncaught PHP Exception TypeError: ’array_intersect_key(): Argument #1 ($array) must be of type array, null given‘ at /core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php line 2479’, referer: /admin/structure/types/manage/projets_programmes_de_recherche/fields/node.projets_programmes_de_recherche.field_pub_anr.

    When I specify a different display mode, I get the same problem...

    Just for complement, my version of Drush is : 13.2.0

    cilefen’s picture

    Project: Drupal core » Entity Update
    Version: 10.3.x-dev » 3.0.x-dev
    Component: entity system » Code
    shasha821110’s picture

    same issue here.
    Drupal 10.3.7. Drush: 13.2.0

    mahmoud barhouma’s picture

    same issue
    Drupal 10.3.10

    saurabh-2k17’s picture

    Hi All, any findings on this yet? Was anyone able to fix this?