Issue #3259110 by longwave, mglaman: Fix undefined variables where files are included

merge-requests/1751/head
Alex Pott 2022-02-01 12:42:01 +00:00
parent 6470ab797c
commit f29ceb64c2
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
3 changed files with 3 additions and 23 deletions

View File

@ -283,12 +283,10 @@ class PhpTransliteration implements TransliterationInterface {
// Read in this file, which should set up a variable called $overrides, // Read in this file, which should set up a variable called $overrides,
// which will be local to this function. // which will be local to this function.
$overrides[$langcode] = [];
if (is_file($file)) { if (is_file($file)) {
include $file; include $file;
} }
if (!isset($overrides) || !is_array($overrides)) {
$overrides = [$langcode => []];
}
$this->languageOverrides[$langcode] = $overrides[$langcode]; $this->languageOverrides[$langcode] = $overrides[$langcode];
} }
@ -311,14 +309,10 @@ class PhpTransliteration implements TransliterationInterface {
// Read in this file, which should set up a variable called $base, which // Read in this file, which should set up a variable called $base, which
// will be local to this function. // will be local to this function.
$base = [];
if (is_file($file)) { if (is_file($file)) {
include $file; include $file;
} }
if (!isset($base) || !is_array($base)) {
$base = [];
}
// Save this data.
$this->genericMap[$bank] = $base; $this->genericMap[$bank] = $base;
} }

View File

@ -132,6 +132,7 @@ function color_get_info($theme) {
$path = \Drupal::service('extension.list.theme')->getPath($theme); $path = \Drupal::service('extension.list.theme')->getPath($theme);
$file = \Drupal::root() . '/' . $path . '/color/color.inc'; $file = \Drupal::root() . '/' . $path . '/color/color.inc';
if ($path && file_exists($file)) { if ($path && file_exists($file)) {
$info = [];
include $file; include $file;
// Add in default values. // Add in default values.
$info += [ $info += [

View File

@ -20,16 +20,6 @@ parameters:
count: 1 count: 1
path: includes/update.inc path: includes/update.inc
-
message: "#^Undefined variable\\: \\$base$#"
count: 1
path: lib/Drupal/Component/Transliteration/PhpTransliteration.php
-
message: "#^Undefined variable\\: \\$overrides$#"
count: 1
path: lib/Drupal/Component/Transliteration/PhpTransliteration.php
- -
message: "#^Call to method getDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#" message: "#^Call to method getDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#"
count: 3 count: 3
@ -300,11 +290,6 @@ parameters:
count: 1 count: 1
path: modules/ckeditor5/src/Controller/CKEditor5ImageController.php path: modules/ckeditor5/src/Controller/CKEditor5ImageController.php
-
message: "#^Undefined variable\\: \\$info$#"
count: 1
path: modules/color/color.module
- -
message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:10\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#" message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:10\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#"
count: 1 count: 1