When viewing /admin/modules


 Fatal error: Unsupported operand types in ./core/includes/theme.inc on line 1038

I believe this is because an attributes array is actually some sort of Twig object.

Comments

c4rl’s picture

Issue tags: +Twig

Yes, this is from calling theme('table_cell') from a Twig file

In theme.inc I did the following:


  if (isset($variables) && !is_array($variables)) {
    print_r($hook);
    var_export($variables);
  }

Which produced:


table_cell

Drupal\Core\Template\TwigReference::__set_state(array(
   'data' => '<span class="element-invisible">Enabled</span>',
   'class' => 
  array (
    0 => 'checkbox',
  ),
   'attributes' => 
  array (
    'class' => 
    array (
      0 => 'checkbox',
    ),
  ),
   'header' => true,
))

So the $variables array is actually a TwigReference object. So I think this is related to #1842160: Consider appropriate usage of theme() from within Twig templates. I'll do some more investigating, but let me try to solve that other issue and perhaps this one will also be resolved.

steveoliver’s picture

Status: Active » Fixed

c4rl: as you suspected, this was caused by a TwigReference object being passed in to theme() when an array was expected. Fixed in the sandbox in git commit 249490c.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Owais Kazmi’s picture

Unsupported operand types in /includes/theme.inc on line 817

soulston’s picture

@Owais Kazmi, are you using the sandbox or drupal 8 core? If it's the sandbox as far as I was aware that was shelved/archived some time ago. If this is a bug against core it's better to open a new ticket.

Project: » Lost & found issues

This issue’s project has disappeared. Most likely, it was a sandbox project, which can be deleted by its maintainer. See the Lost & found issues project page for more details. (The missing project ID was 1750250)