Problem/Motivation
Module doesn't work with Drupal 9.
Proposed resolution
Make compatible with Drupal 9.
Remaining tasks
- Patch - done
- Review
- Commit
User interface changes
None
API changes
None
Data model changes
None
Original description
Problem/Motivation
Clicking the "Add Download option config" link the /admin/config/media/download_options/add page results in :
The website encountered an unexpected error. Please try again later.
Error: Typed property Drupal\file_downloader\Entity\DownloadOptionConfig::$extensions must not be accessed before initialization in Drupal\file_downloader\Entity\DownloadOptionConfig->getExtensions() (line 107 of modules/contrib/file_downloader/src/Entity/DownloadOptionConfig.php).
Drupal\file_downloader\Entity\DownloadOptionConfig->getExtensions() (Line: 108)
Drupal\file_downloader\Form\DownloadOptionConfigForm->form(Array, Object) (Line: 106)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 534)
Drupal\Core\Form\FormBuilder->retrieveForm('download_option_config_add_form', Object) (Line: 281)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 38)
Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 713)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Additional info:
- Drupal version 9.5.3
- Module version 2.0.1
- PHP version 8.0.27
- MySQL version 5.7.29
Steps to reproduce
- Install the latest 2.0.1version of this module
- Enable it
- Navigate to the
/admin/config/media/download_options/add page
- Click the "Add Download option config" link
Proposed resolution
Fix the bug.
Comments
Comment #2
rosk0The problem looked simple at the first glance - not initialised
extensionsproperty, but when I fixed this and hit save it told me thatconfig_exportis missing on the ConfigEntity, which is this https://www.drupal.org/node/2949023 change record for Drupal 8.6.Than it thrown
TypeError: Drupal\file_downloader\DownloadOptionPluginBase::addContextAssignmentElement(): Argument #1 ($plugin) must be of type Drupal\Core\Plugin\ContextAwarePluginInterface, Drupal\file_downloader\Plugin\DownloadOption\OriginalFile given, called in /app/web/modules/contrib/file_downloader/src/DownloadOptionPluginBase.php on line 118 in Drupal\file_downloader\DownloadOptionPluginBase->addContextAssignmentElement() (line 37 of /app/web/core/lib/Drupal/Core/Plugin/ContextAwarePluginAssignmentTrait.php)at me on the edit screen...Fixed that , and than it was time of
Error: Call to undefined method Drupal\Core\File\FileSystem::getScheme() in Drupal\file_downloader\DownloadOptionPluginBase->deliver() (line 71 of modules/contrib/file_downloader/src/DownloadOptionPluginBase.php)., which is this https://www.drupal.org/node/3035273 change record for Drupal 8.8...It looks like this module wasn't tested with Drupal 9 at all...
Will run an full compatibility check a bit later and do some more testing.
Comment #3
rosk0What was done/changed:
ContextAwarePluginInterfaceinterface added to the list of implemented by theDownloadOptionPluginBaseclass (was implemented viaContextAwarePluginTrait)DownloadOptionPluginBaseandDrupal\file_downloader\Plugin\DownloadOption\ImageStyleclassesconfig_exportproperty , listing all the properties from the configuration schemaComment #4
rassoni commentedClicking the "Add Download option config" link the /admin/config/media/download_options/add page results in : issue resolved. But when we tried to add any download option then issue are coming.
Steps to reproduce
when tried to add any option issues are coming
Comment #5
rosk0Have you applied the patch correctly? Have you cleared the cache after that?
I've already tested it on two different code bases - works as expected.
Comment #6
omkar_yewale commentedComment #7
omkar_yewale commentedThanks for the patch. The patch was applied successfully and is working as expected after clearing the cache.
Moving RTBC.
Comment #9
rassoni commentedThanks @RoSk0, After clear cache working as expected. Please review screenshot for more reference,hence created MR.
Comment #10
ericgsmith commentedRerolling against 3.0.0
The same issue is present on the 3.0.0 branch - I would encourage engagement from the maintainers on this issue, it would have been fantastic to have it resolved before 3.0.0 was released.
Comment #13
sjerdo