error on PHP 8.0.26 (cli)

Created on 6 December 2022, about 2 years ago
Updated 14 July 2023, over 1 year ago

Entity module version 7.1.10 compatibility with PHP 8

Error under PHP 8.0

This version works well under PHP 7.4. After deploying to PHP 8.0.26 (cli) (built: Nov 22 2022 17:44:09) ( NTS gcc x86_64 ) we got the following error message:
WD php: TypeError: in_array(): Argument #2 ($haystack) must be of type array, bool given in in_array() (line [error]
1515 of /var/www/eca/sites/all/modules/contrib/entity/entity.module)

Any suggestion? Thanks!

πŸ› Bug report
Status

Postponed: needs info

Version

1.10

Component

Core integration

Created by

πŸ‡ΊπŸ‡ΈUnited States xyxxznpm

Live updates comments and jobs are added and updated live.
  • PHP 8.0

    The issue particularly affects sites running on PHP version 8.0.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

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

  • πŸ‡ΊπŸ‡ΈUnited States atulkamboj

    Try this:

    if (isset($info['controller class']) && class_implements($info['controller class']) === 'EntityAPIControllerInterface')

  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    Try this:

    if (isset($info['controller class']) && class_implements($info['controller class']) === 'EntityAPIControllerInterface')

    No. class_implements() returns either an array or FALSE, neither of which will ever be === to 'EntityAPIControllerInterface'

    The solution is what I said in #5 - find out which module is defining an entity without a controller class, and fix that module. I gave instructions for how to find this out.

  • πŸ‡©πŸ‡°Denmark klausdk

    I had the same issue with the redirect module.

    With drush updb It wants to run :

    function redirect_update_7100() {
      if (!class_exists('RedirectController')) {
        registry_rebuild();
        entity_info_cache_clear();
      }
    }

    But it can't because of the entity error.

    My solution was to run drush php-eval 'registry_rebuild();entity_info_cache_clear()'

    Later I found out that the drush updb had already been executed on a php 7 server, so I was able to get a database dump from there, which fixed the issue.

    Though, I'm not sure if the error will reappear later on.

    Hope it helps.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Use the dev release, the latest tagged release is far behind.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    With that said, I'd love to see a new tagged release of this module

Production build 0.71.5 2024