|Issue tags:||needs backport to D7|
drupal_realpath() function was originally written to ease porting of 6.x code to use 7.x stream wrappers. However, it assumes that every URI may be resolved to an absolute local filesystem path, and this assumption fails when stream wrappers are used to support remote file storage. Remote stream wrappers may implement the realpath() method by always returning FALSE. The use of
drupal_realpath() is therefore discouraged, and may even be deprecated.
The documentation for the
drupal_realpath() should be rewritten to
- Explain why it should generally not be used.
- Point to other functionality that should be used in most cases.
- Point to at least one legitimate use case.
User interface changes
An API change node should be written to explain that the use of
drupal_realpath() is now discouraged or deprecated.
Original report by Damien Tournoud
drupal_realpath() should generally not be used, as it is only meaningful on local filesystems (see #1083982: Fix support for remote streamwrappers for the full discussion). We should extend its documentation to make that fact clear.