1

I noticed the error regarding Web Widgets ever since upgrading from PHP 5.3.3 to PHP 7.0.2. Line 1088 is the following:

$variables += $info['variables'];

After originally posting in the module's issue queue, I was told by the maintainer that a theme function with a value instead of an array needs to be called. So I checked the web_widgets.module file, and found three functions that return the theme variable, at least one of which I think might be the source of the problem:

1):

function web_widgets_theme($existing, $type, $theme, $path) {
  $theme = array(
    'web_widgets_embed_code' => array(
      'variables' => array('code' => NULL, 'style' => NULL),
    ),
    'web_widgets_tracking_code' => array(
      'variables' => array('id' => NULL),
    ),
  );
  $style_files = array_keys(web_widgets_get_styles());
  foreach ($style_files as $style) {
    require_once DRUPAL_ROOT . '/' . web_widgets_get_style_inc($style);
    $definition = call_user_func('web_widgets_style_' . $style);
    if (is_array($definition['theme'])) {
      $theme += $definition['theme'];
    }
  }
  return $theme;
}

2):

function web_widgets_render_embed_code($style, $variables) {
  require_once DRUPAL_ROOT . '/' . web_widgets_get_style_inc($style);
  // TODO Please change this theme call to use an associative array for the $variables parameter.
  $code = theme('web_widgets_' . $style, $variables);

  // TODO Please change this theme call to use an associative array for the $variables parameter.
  return theme('web_widgets_embed_code', array('code' => $code, 'style' => $style));
}

3):

function web_widgets_render_widget($style, $content, $title, $add_target = TRUE, $scripts = array(), $styles = array()) {
  require_once DRUPAL_ROOT . '/' . web_widgets_get_style_inc($style);
  if ($add_target === TRUE) {
    $content = _web_widgets_rewrite_anchors($content);
  }
  module_invoke_all('web_widgets_render_widget', $content, $title);

  return theme('web_widgets_' . $style . '_wrapper', array(
    'content' => $content,
    'title' => $title,
    'scripts' => $scripts,
    'styles' => $styles
  ));
}

This is how far I got so far. Does anyone know how to solve this issue, or at least its level of complexity? Any help would be greatly appreciated.

2
  • The maintainer is saying there is a call to theme() that is getting a value that is not an array as second argument; which module is doing that is not known. You just need to debug your site; we cannot do it for you.
    – apaderno
    Jan 20, 2016 at 7:58
  • I'm pretty sure it's Web Widgets, because I get the dreaded WSOD whenever it's accessed. The problem is that I don't know of a way to debug it because of the way the module works where it's only used when another website embeds code via widgets generated from it. I tried using Devel and got lost because there were dozens if not hundreds of lines to click, and I didn't know whether any of them were related to this module or not.
    – Jay Lee
    Jan 20, 2016 at 8:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.