Warning: array_flip(): Can only flip STRING and INTEGER values! in Drupal\Core\Entity\ContentEntityStorageBase->loadMultipleRevisions() (line 666 of core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php).

Created on 27 December 2021, almost 3 years ago
Updated 2 August 2024, 5 months ago

Problem/Motivation

Hi, After updating Drupal core from 9.2.10 to 9.3.0, i have getting two warnings on node entity revision page. Note that content types have moderation state enabled.

Warning: array_flip(): Can only flip STRING and INTEGER values! in Drupal\Core\Entity\ContentEntityStorageBase->loadMultipleRevisions() (line 666 of core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php).

Warning: Illegal offset type in Drupal\Core\Entity\ContentEntityStorageBase->loadRevision() (line 635 of core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php).

Steps to reproduce

Update Drupal core from 9.2.10 to 9.3.0.
Open any node revision page, Example: /node/5261/revisions/124171/view

Proposed resolution

Warning should not be thrown and code should handle any null value if passed

๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Node systemย  โ†’

Last updated 4 days ago

No maintainer
Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia gaurav_manerkar Vasco Da Gama, Goa

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sahilgidwani Jaipur

    I am reopening this issue, as I am getting warnings and errors, as mentioned in the descriptions in version 9.5.9 and PHP 8.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada No Sssweat

    After upgrading from PHP 7.4 to 8.1

    I am also seeing the type error and the array flip warning that comment #5 mentions with Drupal 9.5.11

    TypeError: Illegal offset type in Drupal\Core\Entity\ContentEntityStorageBase->loadRevision() (line 636 of /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php)

    Warning: array_flip(): Can only flip string and integer values, entry skipped in Drupal\Core\Entity\ContentEntityStorageBase->loadMultipleRevisions() (line 667 of /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php)

    Going through the code in xdebug for some reason with PHP 8.1 it triggers different kernel events compared to 7.4 with the same codebase and DB.

    7.4 does a kernerl.response while 8.1 does a kernel.controller event.

    Also 7.4 has more service definitions while 8.1 has less (802 vs 754)

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada No Sssweat

    As mentioned in comment #6, because of the different kernel events. Different values end up being passed to the error and the warning lines.

    One of these values is an empty revisions array and a node object as a revision id instead of a string or int.

    This might not be the optimal solution, but I manage to get passed those by checking if it's not empty.

  • last update about 1 year ago
    30,341 pass
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

    samit.310@gmail.com โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Success
    5 months ago
    Total: 682s
    #241488
  • Status changed to Needs review 5 months ago
  • Status changed to Needs work 5 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Think it needs to be determined why that's empty and findings be added to the issue summary. Just putting a simple check most likely could be masking a larger issue.

Production build 0.71.5 2024