TypeError: Illegal offset type in isset or empty in ThemeRegistry->offsetExists()

Created on 11 March 2023, over 1 year ago

Problem/Motivation

WSOD on all pages outside /admin/ while maintenance mode is on

dblog report on any blank page refresh
TypeError: Illegal offset type in isset or empty in ThemeRegistry->offsetExists() (line 421 of /htdocs/includes/theme.inc).

Steps to reproduce

Enable maintenance mode, manually or drush vset maintenance_mode 1. Try to visit your website/refresh page that is not admin area.

This most likely has something to do with PHP 8.1, because that's when the issue started, upgrading from PHP 7 to 8.1.

🐛 Bug report
Status

Postponed: needs info

Version

7.0 ⚰️

Component
Theme 

Last updated 1 minute ago

Created by

🇱🇹Lithuania vibrasphere

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

Comments & Activities

  • Issue created by @vibrasphere
  • Status changed to Postponed: needs info over 1 year ago
  • 🇺🇸United States cilefen

    I cannot reproduce this. Here is what I did:

    1. Installed Drupal 7.x on PHP 8.1 (standard install).
    2. Turned on maintenance mode at /admin/config/development/maintenance.
    3. Visited the home page and /node/add. There are no errors.

    What else is required to reproduce the bug?

  • 🇱🇹Lithuania vibrasphere

    Hello, I enabled some extra error logging with

    error_reporting(E_ALL);
    ini_set('display_errors', TRUE);
    ini_set('display_startup_errors', TRUE);
    $conf['error_level'] = 2;

    It shows:

    Deprecated: Optional parameter $data declared before required parameter $name is implicitly treated as a required parameter in /htdocs/sites/all/modules/commerce/modules/cart/commerce_cart.module on line 1202
    
    Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in /htdocs/includes/theme.inc:421 Stack trace: #0 /users/htdocs/includes/theme.inc(1150):ThemeRegistry->offsetExists() #1 /htdocs/includes/errors.inc(252): theme() #2 /htdocs/includes/bootstrap.inc(2672): _drupal_log_error() #3 [internal function]: _drupal_exception_handler() #4 {main} thrown in /htdocs/includes/theme.inc on line 421

    Is this two separate unrelated errors, or Commerce error is causing the Drupal core ThemeRegistry error?

  • 🇱🇹Lithuania vibrasphere

    Okay it's not related, the Commerce error can be patched with https://www.drupal.org/project/commerce/issues/3284128#comment-14616806 📌 Required parameter $options follows optional parameter $data in commerce_cart.module on line 1163 Fixed

    Now it's just:

    Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in /htdocs/includes/theme.inc:421 Stack trace: #0 /htdocs/includes/theme.inc(1150): ThemeRegistry->offsetExists() #1 /htdocs/includes/errors.inc(252): theme() #2 /htdocs/includes/bootstrap.inc(2672): _drupal_log_error() #3 [internal function]: _drupal_exception_handler() #4 {main} thrown in /htdocs/includes/theme.inc on line 421

    There are no other errors logged.

Production build 0.69.0 2024