Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#3 | array_member_variables-2921682-3.patch | 1.01 KB | zaporylie |
Comments
Comment #2
zaporylieComment #3
zaporylieSimple patch which removes variables initialization with NULL.
Comment #5
markhalliwellComment #6
alexpottThere'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!