Problem/Motivation

The following code:

  // Render title for the admin preview.
  if (!empty($view->live_preview)) {
    $variables['title']['#markup'] = $view->getTitle();
  }

causes:

exception: [Warning] Line 137 of core/modules/views_ui/views_ui.module:
Illegal string offset '#markup'

Proposed resolution

In PHP 7.1 a warning is raised if you suddenly treat a string as an array.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

CommentFileSizeAuthor
#2 2842763-2.patch599 bytesalexpott
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Status: Active » Needs review
FileSize
599 bytes

You can run Drupal\views_ui\Tests\SettingsTest on 7.1 to see this fail. This test passes with the attached patch.

alexpott’s picture

cilefen’s picture

Status: Needs review » Reviewed & tested by the community

I verified on 7.1 as described.

  • catch committed ab8284b on 8.3.x
    Issue #2842763 by alexpott: views_ui_preprocess_views_view() broken in...

  • catch committed 0a429dd on 8.2.x
    Issue #2842763 by alexpott: views_ui_preprocess_views_view() broken in...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!

Status: Fixed » Closed (fixed)

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