Unverified Commit 01a737b3 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3240220 by alexpott: \Drupal\file\Entity\File::getSize() can cause deprecations on PHP 8.1

parent c9ec5e43
Loading
Loading
Loading
Loading
+1 −1
Changes for core/modules/file/file.module: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -1510,7 +1510,7 @@ function template_preprocess_file_link(&$variables) {
  // Set file classes to the options array.
  $variables['attributes'] = new Attribute($variables['attributes']);
  $variables['attributes']->addClass($classes);
  $variables['file_size'] = format_size($file->getSize());
  $variables['file_size'] = format_size($file->getSize() ?? 0);

  $variables['link'] = Link::fromTextAndUrl($link_text, $url->setOptions($options))->toRenderable();
}