function file_stream_wrapper_uri_normalize

Same name in other branches
  1. 7.x includes/file.inc \file_stream_wrapper_uri_normalize()

Normalizes a URI by making it syntactically correct.

A stream is referenced as "scheme://target".

The following actions are taken:

  • Remove trailing slashes from target
  • Trim erroneous leading slashes from target. e.g. ":///" becomes "://".

Parameters

string $uri: String reference containing the URI to normalize.

Return value

string The normalized URI.

Deprecated

in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::normalizeUri() instead.

See also

https://www.drupal.org/node/3035273

Related topics

2 calls to file_stream_wrapper_uri_normalize()
FileSystemDeprecationTest::testDeprecatedFileStreamWrapperUriNormalize in core/tests/Drupal/KernelTests/Core/File/FileSystemDeprecationTest.php
@expectedDeprecation file_stream_wrapper_uri_normalize() is deprecated in drupal:8.8.0 and will be removed before drupal:9.0.0. Use \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::normalizeUri() instead. See https://www.drupal.org/node/3035273
file_unmanaged_prepare in core/includes/file.inc
Internal function that prepares the destination for a file_unmanaged_copy or file_unmanaged_move operation.

File

core/includes/file.inc, line 183

Code

function file_stream_wrapper_uri_normalize($uri) {
    @trigger_error('file_stream_wrapper_uri_normalize() is deprecated in drupal:8.8.0 and will be removed before drupal:9.0.0. Use \\Drupal\\Core\\StreamWrapper\\StreamWrapperManagerInterface::normalizeUri() instead. See https://www.drupal.org/node/3035273', E_USER_DEPRECATED);
    return \Drupal::service('stream_wrapper_manager')->normalizeUri($uri);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.