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://')); + } + }