warnings issued on 'drush' command using PHP 7.X

Created on 9 August 2019, over 5 years ago
Updated 2 February 2023, almost 2 years ago

Problem/Motivation

General description of the issue

After switching to PHP7 (in this specific case is PHP 7.2.19) we noticed that drush cc all command would clog the output with many repeated warnings

Illegal string offset 'type' page.admin.inc:163   [warning]
Illegal string offset 'type' page.admin.inc:166   [warning]
[...]

this behaviour doesn't happen using PHP 5.6 (specifically PHP 5.6.40).

Relevant information about software/versions

Issue presented itself in Unix/Linux shell environment (bash/zsh) using

  • drush 8.2.3
  • Drupal 7.67
  • PHP 7.2.19
  • ctools 7.x-1.15
  • ctools_custom_content 7.x-1.15

Proposed resolution

We patched ctools page_manager/plugins/tasks/page.admin.inc file adding some minimal check upon $menu variable being an array (apparently, when loaded from a drush call it is not):

code

  if (empty($menu['type'])) {
    $menu['type'] = 'none';
  }

became

  if (is_array($menu) && empty($menu['type'])) {
    $menu['type'] = 'none';
  }
  else if(!is_array($menu)) {
    $menu = ['type' => 'none'];
  }
  else if(empty($menu['type'])) {
   $menu['type'] = 'none';
  }
🐛 Bug report
Status

Closed: outdated

Version

1.0

Component

Page Manager

Created by

🇩🇪Germany giuspe Berlin

Live updates comments and jobs are added and updated live.
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.

Production build 0.71.5 2024