function file_valid_uri

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

Determines whether the URI has a valid scheme for file API operations.

There must be a scheme and it must be a Drupal-provided scheme like 'public', 'private', 'temporary', or an extension provided with hook_stream_wrappers().

Parameters

$uri: The URI to be tested.

Return value

TRUE if the URI is allowed.

Deprecated

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

See also

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

Related topics

1 call to file_valid_uri()
FileSystemDeprecationTest::testDeprecatedValidUri in core/tests/Drupal/KernelTests/Core/File/FileSystemDeprecationTest.php
@expectedDeprecation file_valid_uri() is deprecated in drupal:8.8.0 and will be removed before drupal:9.0.0. Use \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::isValidUri() instead. See https://www.drupal.org/node/3035273

File

core/includes/file.inc, line 402

Code

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

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