Problem/Motivation

In /core/lib/Drupal/Core/Template/TwigSandboxPolicy.php member variables $whitelisted_methods, $whitelisted_prefixes and $whitelisted_classes are initialized with NULL, which is wrong for two reasons:

  • each member variable is expected to be an array (see constructor)
  • there is no need to initialize variable with NULL as that's default value for uninitialized member variables

Proposed resolution

Do not initialize member variables in TwigSandboxPolicy

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zaporylie created an issue. See original summary.

zaporylie’s picture

Category: Task » Bug report
zaporylie’s picture

Status: Active » Needs review
FileSize
1.01 KB

Simple patch which removes variables initialization with NULL.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

markhalliwell’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Category: Bug report » Task
Status: Reviewed & tested by the community » Fixed

There's no bug being fixed here. There is no change. Regardless of the = NULL class properties are NULL. But this is a tidy up so +1.

I think this is really a docs only patch so backported to 8.5.x

Committed and pushed 4cf7a965e9 to 8.6.x and 607d87f026 to 8.5.x. Thanks!

  • alexpott committed 4cf7a96 on 8.6.x
    Issue #2921682 by zaporylie: Array member variables initialized with...

  • alexpott committed 607d87f on 8.5.x
    Issue #2921682 by zaporylie: Array member variables initialized with...

Status: Fixed » Closed (fixed)

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