Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer version not set correctly to framework version when tagged #1192

Closed
2 tasks done
mandrew opened this issue May 20, 2024 · 3 comments
Closed
2 tasks done

Composer version not set correctly to framework version when tagged #1192

mandrew opened this issue May 20, 2024 · 3 comments

Comments

@mandrew
Copy link

mandrew commented May 20, 2024

Module version(s) affected

5.2.1

Description

Currently composer install gets the latest version of elemental for any version of v5 framework "silverstripe/framework": "^5", which creates issues if you are still running an older version of framework e.g. 5.0.0.

I only worked out after reading the release info that as I'm currently working on a v5.0.0 site, I should be using v5.0.4 of elemental. It's a straightforward fix as a Developer, however composer should really handle these dependancies so I don't have to think about it :)

How to reproduce

  1. Install SIlverstripe 5.0.0 with elemental
  2. Search in the CMS for a word that you know exists on a page
  3. Error appears saying:
[Emergency] Uncaught BadMethodCallException: Object->__call(): the method 'eagerLoad' does not exist on 'SilverStripe\ORM\DataList'

GET /admin/pages?q%5BFilterClass%5D=DNADesign%5CElemental%5CControllers%5CElementSiteTreeFilterSearch&q%5BTerm%5D=test

Line 57 in /var/www/html/vendor/silverstripe/framework/src/Core/CustomMethods.php
click to see full error and stack trace
Source

48      * @throws BadMethodCallException

49      */

50     public function __call($method, $arguments)

51     {

52         // If the method cache was cleared by an an Object::add_extension() / Object::remove_extension()

53         // call, then we should rebuild it.

54         $class = static::class;

55         $config = $this->getExtraMethodConfig($method);

56         if (empty($config)) {

57             throw new BadMethodCallException(

58                 "Object->__call(): the method '$method' does not exist on '$class'"

59             );

60         }

61

62         switch (true) {

63             case isset($config['callback']): {

Trace

SilverStripe\View\ViewableData->__call(eagerLoad, Array)
ElementalPageExtension.php:138
DNADesign\Elemental\Extensions\ElementalPageExtension->getEagerLoadedElements()
ElementalPageExtension.php:85
DNADesign\Elemental\Extensions\ElementalPageExtension->getContentFromElementsForCmsSearch()
call_user_func_array(Array, Array)
Extensible.php:135
SilverStripe\View\ViewableData->SilverStripe\Core\{closure}(ACC\SYA\Pages\TopicPage, Array)
CustomMethods.php:64
SilverStripe\View\ViewableData->__call(getContentFromElementsForCmsSearch, Array)
ElementSiteTreeFilterSearch.php:61
DNADesign\Elemental\Controllers\ElementSiteTreeFilterSearch->DNADesign\Elemental\Controllers\{closure}(ACC\SYA\Pages\TopicPage, SilverStripe\ORM\DataList)
call_user_func(Closure, ACC\SYA\Pages\TopicPage, SilverStripe\ORM\DataList)
DataList.php:558
SilverStripe\ORM\DataList->filterByCallback(Closure)
ElementSiteTreeFilterSearch.php:66
DNADesign\Elemental\Controllers\ElementSiteTreeFilterSearch->applyDefaultFilters(SilverStripe\ORM\DataList)
CMSSiteTreeFilter_Search.php:27
SilverStripe\CMS\Controllers\CMSSiteTreeFilter_Search->getFilteredPages()
CMSMain.php:1611
SilverStripe\CMS\Controllers\CMSMain->getList(Array, )
CMSMain.php:1630
SilverStripe\CMS\Controllers\CMSMain->ListViewForm()
call_user_func_array(Array, Array)
ViewableData.php:557
SilverStripe\View\ViewableData->obj(ListViewForm, , 1)
ViewableData.php:619
SilverStripe\View\ViewableData->XML_val(ListViewForm, , 1)
SSViewer_Scope.php:342
SilverStripe\View\SSViewer_Scope->__call(XML_val, Array)
SSViewer_DataPresenter.php:327
SilverStripe\View\SSViewer_DataPresenter->__call(XML_val, Array)
.cachevendor.silverstripe.cms.templates.SilverStripe.CMS.Controllers.Includes.CMSMain_ListView.ss:23
include(/tmp/silverstripe-cache-php8.1.23-var-www-html/www-data/.cachevendor.silverstripe.cms.templates.SilverStripe.CMS.Controllers.Includes.CMSMain_ListView.ss)
SSViewer.php:576
SilverStripe\View\SSViewer->includeGeneratedTemplate(/tmp/silverstripe-cache-php8.1.23-var-www-html/www-data/.cachevendor.silverstripe.cms.templates.SilverStripe.CMS.Controllers.Includes.CMSMain_ListView.ss, SilverStripe\CMS\Controllers\CMSPagesController, Array, Array, SilverStripe\View\SSViewer_DataPresenter)
SSViewer.php:648
SilverStripe\View\SSViewer->process(SilverStripe\CMS\Controllers\CMSPagesController, Array, SilverStripe\View\SSViewer_DataPresenter)
SSViewerProxy.php:53
LeKoala\DebugBar\Proxy\SSViewerProxy->process(SilverStripe\CMS\Controllers\CMSPagesController, Array, SilverStripe\View\SSViewer_DataPresenter)
SSViewer.php:738
SilverStripe\View\SSViewer::execute_template(Array, SilverStripe\CMS\Controllers\CMSPagesController, Array, SilverStripe\View\SSViewer_DataPresenter, 1)
.cachevendor.silverstripe.cms.templates.SilverStripe.CMS.Controllers.Includes.CMSMain_PageList.ss:39
include(/tmp/silverstripe-cache-php8.1.23-var-www-html/www-data/.cachevendor.silverstripe.cms.templates.SilverStripe.CMS.Controllers.Includes.CMSMain_PageList.ss)
SSViewer.php:576
SilverStripe\View\SSViewer->includeGeneratedTemplate(/tmp/silverstripe-cache-php8.1.23-var-www-html/www-data/.cachevendor.silverstripe.cms.templates.SilverStripe.CMS.Controllers.Includes.CMSMain_PageList.ss, SilverStripe\CMS\Controllers\CMSPagesController, , Array, )
SSViewer.php:648
SilverStripe\View\SSViewer->process(SilverStripe\CMS\Controllers\CMSPagesController, , )
SSViewerProxy.php:53
LeKoala\DebugBar\Proxy\SSViewerProxy->process(SilverStripe\CMS\Controllers\CMSPagesController, )
ViewableData.php:473
SilverStripe\View\ViewableData->renderWith(LeKoala\DebugBar\Proxy\SSViewerProxy)
CMSMain.php:230
SilverStripe\CMS\Controllers\CMSMain->PageList()
call_user_func_array(Array, Array)
ViewableData.php:557
SilverStripe\View\ViewableData->obj(PageList, , 1)
ViewableData.php:619
SilverStripe\View\ViewableData->XML_val(PageList, , 1)
SSViewer_Scope.php:342
SilverStripe\View\SSViewer_Scope->__call(XML_val, Array)
SSViewer_DataPresenter.php:327
SilverStripe\View\SSViewer_DataPresenter->__call(XML_val, Array)
.cachevendor.silverstripe.cms.templates.SilverStripe.CMS.Controllers.Includes.CMSPagesController_Content.ss:46
include(/tmp/silverstripe-cache-php8.1.23-var-www-html/www-data/.cachevendor.silverstripe.cms.templates.SilverStripe.CMS.Controllers.Includes.CMSPagesController_Content.ss)
SSViewer.php:576
SilverStripe\View\SSViewer->includeGeneratedTemplate(/tmp/silverstripe-cache-php8.1.23-var-www-html/www-data/.cachevendor.silverstripe.cms.templates.SilverStripe.CMS.Controllers.Includes.CMSPagesController_Content.ss, SilverStripe\CMS\Controllers\CMSPagesController, , Array, )
SSViewer.php:648
SilverStripe\View\SSViewer->process(SilverStripe\CMS\Controllers\CMSPagesController, , )
SSViewerProxy.php:53
LeKoala\DebugBar\Proxy\SSViewerProxy->process(SilverStripe\CMS\Controllers\CMSPagesController, )
ViewableData.php:473
SilverStripe\View\ViewableData->renderWith(LeKoala\DebugBar\Proxy\SSViewerProxy)
LeftAndMain.php:1153
SilverStripe\Admin\LeftAndMain->Content()
call_user_func_array(Array, Array)
ViewableData.php:557
SilverStripe\View\ViewableData->obj(Content, , 1)
ViewableData.php:619
SilverStripe\View\ViewableData->XML_val(Content, , 1)
SSViewer_Scope.php:342
SilverStripe\View\SSViewer_Scope->__call(XML_val, Array)
SSViewer_DataPresenter.php:327
SilverStripe\View\SSViewer_DataPresenter->__call(XML_val, Array)
.cachevendor.silverstripe.admin.templates.SilverStripe.Admin.LeftAndMain.ss:48
include(/tmp/silverstripe-cache-php8.1.23-var-www-html/www-data/.cachevendor.silverstripe.admin.templates.SilverStripe.Admin.LeftAndMain.ss)
SSViewer.php:576
SilverStripe\View\SSViewer->includeGeneratedTemplate(/tmp/silverstripe-cache-php8.1.23-var-www-html/www-data/.cachevendor.silverstripe.admin.templates.SilverStripe.Admin.LeftAndMain.ss, SilverStripe\CMS\Controllers\CMSPagesController, , Array, )
SSViewer.php:648
SilverStripe\View\SSViewer->process(SilverStripe\CMS\Controllers\CMSPagesController, , )
SSViewerProxy.php:53
LeKoala\DebugBar\Proxy\SSViewerProxy->process(SilverStripe\CMS\Controllers\CMSPagesController, )
ViewableData.php:473
SilverStripe\View\ViewableData->renderWith(LeKoala\DebugBar\Proxy\SSViewerProxy)
LeftAndMain.php:1009
SilverStripe\Admin\LeftAndMain->SilverStripe\Admin\{closure}()
call_user_func(Closure)
PjaxResponseNegotiator.php:88
SilverStripe\Control\PjaxResponseNegotiator->respond(SilverStripe\Control\HTTPRequest)
LeftAndMain.php:863
SilverStripe\Admin\LeftAndMain->index(SilverStripe\Control\HTTPRequest)
CMSMain.php:208
SilverStripe\CMS\Controllers\CMSMain->index(SilverStripe\Control\HTTPRequest)
RequestHandler.php:323
SilverStripe\Control\RequestHandler->handleAction(SilverStripe\Control\HTTPRequest, index)
Controller.php:276
SilverStripe\Control\Controller->handleAction(SilverStripe\Control\HTTPRequest, index)
RequestHandler.php:202
SilverStripe\Control\RequestHandler->handleRequest(SilverStripe\Control\HTTPRequest)
Controller.php:202
SilverStripe\Control\Controller->handleRequest(SilverStripe\Control\HTTPRequest)
LeftAndMain.php:799
SilverStripe\Admin\LeftAndMain->handleRequest(SilverStripe\Control\HTTPRequest)
AdminRootController.php:124
SilverStripe\Admin\AdminRootController->handleRequest(SilverStripe\Control\HTTPRequest)
Director.php:349
SilverStripe\Control\Director->SilverStripe\Control\{closure}(SilverStripe\Control\HTTPRequest)
VersionedHTTPMiddleware.php:41
SilverStripe\Versioned\VersionedHTTPMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
LoginSessionMiddleware.php:53
SilverStripe\SessionManager\Middleware\LoginSessionMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
ConfirmationMiddleware.php:254
SilverStripe\Control\Middleware\ConfirmationMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
ConfirmationMiddleware.php:254
SilverStripe\Control\Middleware\ConfirmationMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
ExecMetricMiddleware.php:20
SilverStripe\Control\Middleware\ExecMetricMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
PasswordExpirationMiddleware.php:84
SilverStripe\Security\PasswordExpirationMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
BasicAuthMiddleware.php:68
SilverStripe\Security\BasicAuthMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
AuthenticationMiddleware.php:61
SilverStripe\Security\AuthenticationMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
CanonicalURLMiddleware.php:245
SilverStripe\Control\Middleware\CanonicalURLMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
HTTPCacheControlMiddleware.php:41
SilverStripe\Control\Middleware\HTTPCacheControlMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
ChangeDetectionMiddleware.php:28
SilverStripe\Control\Middleware\ChangeDetectionMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
FlushMiddleware.php:31
SilverStripe\Control\Middleware\FlushMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
SessionMiddleware.php:20
SilverStripe\Control\Middleware\SessionMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
AllowedHostsMiddleware.php:60
SilverStripe\Control\Middleware\AllowedHostsMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
TrustedProxyMiddleware.php:176
SilverStripe\Control\Middleware\TrustedProxyMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
DebugBarMiddleware.php:17
LeKoala\DebugBar\Middleware\DebugBarMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
HTTPMiddlewareAware.php:65
SilverStripe\Control\Director->callMiddleware(SilverStripe\Control\HTTPRequest, Closure)
Director.php:358
SilverStripe\Control\Director->handleRequest(SilverStripe\Control\HTTPRequest)
HTTPApplication.php:114
SilverStripe\Control\HTTPApplication::SilverStripe\Control\{closure}(SilverStripe\Control\HTTPRequest)
call_user_func(Closure, SilverStripe\Control\HTTPRequest)
HTTPApplication.php:137
SilverStripe\Control\HTTPApplication->SilverStripe\Control\{closure}(SilverStripe\Control\HTTPRequest)
HTTPMiddlewareAware.php:65
SilverStripe\Control\HTTPApplication->callMiddleware(SilverStripe\Control\HTTPRequest, Closure)
HTTPApplication.php:138
SilverStripe\Control\HTTPApplication->execute(SilverStripe\Control\HTTPRequest, Closure, )
HTTPApplication.php:113
SilverStripe\Control\HTTPApplication->handle(SilverStripe\Control\HTTPRequest)
index.php:24

Looks like #1069 was introduced, which means you need to be running v5.1 of the framework for this to not error.

Possible Solution

  • Tag elemental 5.0.* to framework v5.0.*
  • Recommend a review of elemental 5.1.* and 5.2.* to confirm if tagging to the appropriate framework version is necessary
  • Review ongoing tagging process so there is a consistent approach for the next tagged versions of elemental

Additional Context

No response

Validations

  • Check that there isn't already an issue that reports the same bug
  • Double check that your reproduction steps work in a fresh installation of silverstripe/installer (with any code examples you've provided)

Acceptance criteria

  • The dependency on dnadesign/silverstripe-elemental for silverstripe/framework is bumped to the lowest version that doesn't cause an error (only affects next minor release of this module)

PR

@GuySartorelli
Copy link
Member

Thanks for reporting this - we try to keep on top of those sorts of changes but looks like we dropped the ball on that one.
We won't be overriding existing tags, but we'll bump the dependency for the next minor release to help mitigate this somewhat.

@GuySartorelli
Copy link
Member

I've also opened silverstripe/gha-generate-matrix#93 to update our CI to help us catch this sort of problem ahead of releases going forward.

@emteknetnz emteknetnz self-assigned this May 21, 2024
@emteknetnz emteknetnz removed their assignment May 21, 2024
@GuySartorelli
Copy link
Member

PR merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants