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.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | interdiff-748200-3-5.txt | 985 bytes | kerby70 |
| #5 | allow_for_late_binding-748200-5.patch | 645 bytes | kerby70 |
| #3 | stream-wrapper-late-binding.patch | 676 bytes | jbrown |
| stream_wrapper_late_binding.patch | 730 bytes | kkaefer |
Comments
Comment #1
jbrown commentedstream_wrapper_late_binding.patch queued for re-testing.
Comment #3
jbrown commentedComment #4
thedavidmeister commentedThis is still a bug in d8.
Patch looks RTBC from me after a re-roll.
Comment #5
kerby70 commentedReroll attached. Note
drupal_encode_path($path)changed toUrlHelper::encodePath($path)Comment #6
mgiffordNeeds re-roll.
Comment #19
catchThis hasn't been an issue since 2015 after
c1316d695782. Marking as outdated.