From 442a3f224af3433ba5af0d35bd3e4575603c1a1c Mon Sep 17 00:00:00 2001 From: catch Date: Thu, 18 Jul 2019 11:49:52 +0100 Subject: [PATCH] Issue #3068022 by kim.pepper: Properly deprecate drupal_realpath() --- core/includes/file.inc | 1 + .../KernelTests/Core/File/FileSystemDeprecationTest.php | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/core/includes/file.inc b/core/includes/file.inc index 5327a38035c..765467fd638 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -1121,6 +1121,7 @@ function drupal_unlink($uri, $context = NULL) { * @see https://www.drupal.org/node/2418133 */ function drupal_realpath($uri) { + @trigger_error('drupal_realpath() is deprecated in drupal:8.0.0 and will be removed in drupal:9.0.0. Use \Drupal\Core\File\FileSystemInterface::realpath(). See https://www.drupal.org/node/2418133.', E_USER_DEPRECATED); return \Drupal::service('file_system')->realpath($uri); } diff --git a/core/tests/Drupal/KernelTests/Core/File/FileSystemDeprecationTest.php b/core/tests/Drupal/KernelTests/Core/File/FileSystemDeprecationTest.php index c70a3e11fb6..58893d1fc47 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileSystemDeprecationTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileSystemDeprecationTest.php @@ -252,4 +252,11 @@ class FileSystemDeprecationTest extends KernelTestBase { return $data; } + /** + * @expectedDeprecation drupal_realpath() is deprecated in drupal:8.0.0 and will be removed in drupal:9.0.0. Use \Drupal\Core\File\FileSystemInterface::realpath(). See https://www.drupal.org/node/2418133. + */ + public function testRealpath() { + $this->assertNotEmpty(drupal_realpath('public://')); + } + }