Allow for late binding in DrupalPublicStreamWrapper's getExternalUrl() method

Created on 20 March 2010, over 14 years ago
Updated 29 August 2023, about 1 year ago

Problem/Motivation

The Public Stream Wrapper uses self::getDirectoryPath() to call the getDirectoryPath() method in an instantiated object context. This means that PHP does early binding and calls DrupalPublicStreamWrapper's getDirectoryPath() method, even when using a stream wrapper that inherits from DrupalPublicStreamWrapper. This means that you have to redefine getExternalUrl() in your custom stream wrapper class just to use your overridden getDirectoryPath() method.

Proposed resolution

Make getExternalUrl() call the current instance's getDirectoryPath() method instead of DrupalPublicStreamWrapper's version of that method.

Remaining tasks

Re-roll patch.

User interface changes

None.

API changes

PublicStream will work slightly differently (in a good way).

Original report

For some reason, the public stream wrapper uses self::getDirectoryPath() to call the getDirectoryPath() method in an instantiated object context. This means that PHP does early binding and calls DrupalPublicStreamWrapper's getDirectoryPath() method, even when using a stream wrapper that inherits from DrupalPublicStreamWrapper. This means that you have to redefine getExternalUrl() in your custom stream wrapper class just to use your overridden getDirectoryPath() method.

This patch makes getExternalUrl() call the current instance's getDirectoryPath() method instead of DrupalPublicStreamWrapper's version of that method.

🐛 Bug report
Status

Closed: outdated

Version

9.5

Component
File system 

Last updated about 3 hours ago

Created by

🇩🇪Germany kkaefer

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024