php - Exception in RainLab Blog: Method (getRouter) Not Found

859

(Newbie here, with what I hope is a simple problem!) After running WP for years, I decided to try something a bit more 'involved' and switched to OctoberCMS and poked around on W3Schools PHP.

But after a recent RainLab Blog update, my site only reroutes to an Exception Error. This is what I get for playing webmaster.

The error message is as follows:The component 'RainLab\Blog\Components\Post' does not contain a method 'getRouter'

  catch (BadMethodCallException $ex) {}

        if (method_exists($this->controller, $method)) {
            return call_user_func_array([$this->controller, $method], $parameters);
        }

        throw new BadMethodCallException(Lang::get('cms::lang.component.method_not_found', [
            'name' => get_class($this),
            'method' => $method
        ]));
    }

    /**

I can access the file in question (having downloaded it for analysis) but cannot figure out how to fix the error, or even what getRouter is!

Google has failed me, and I just need a little bit of direction!

I have looked at the documentation on GitHub, and at similar error messages elsewhere, but I do not at this time understand enough to extrapolate my solution from any others.

The installation is all default, aside from some CSS changes and stylesheets I modified. AFAIK, CSS should not be interfering with the PHP backend however.

As far as solutions: If there is a way to prevent this handling; any method that allows the site to display as normal (rather than throwing this stupid error message)!


EDIT: Here is a backend log (sorry for the length--I am unsure what exactly is important.

EDIT 2: As far as I know, nothing is "custom" beyond having a few different plugins installed--Blog, Comments, Embed, and a couple others. (I thought a minimal installation would help avoid this! But I am enjoying learning overall, despite the frustrations.)



    Dashboard CMS Media Pages Blog Comments Users Settings 

    Misc
        Comments Manage Settings.
    CMS
        Front-end theme Manage the front-end theme and customization options.
        Maintenance mode Configure the maintenance mode page and toggle the setting.
    System
        Updates & Plugins Update the system, manage and install plugins and themes.
        Administrators Manage back-end administrator users, groups and permissions.
        Editor settings Customize the global editor preferences, such as font size and color scheme.
        Customize back-end Customize the administration area such as name, colors and logo.
    Users
        User settings Manage user based settings.
    Blog
        Blog Manage blog settings
    Mail
    Logs
        Event log View system log messages with their recorded time and details.
        Theme log View changes made to the active theme.
        Request log View bad or redirected requests, such as Page not found (404).
        Access log View a list of successful back-end user sign ins.
        Log settings Specify which areas should use logging.

    Event log Event 

Event ID

#2899
Level

Error
Date & Time

Sun, Jun 16, 2019 7:40 PM

    Formatted
    Raw

BadMethodCallException: The component 'RainLab\Blog\Components\Post' does not contain a method 'getRouter'. in /home/andmorew/public_html/modules/cms/classes/ComponentBase.php:315
Stack trace:
#0 /home/andmorew/public_html/plugins/vdomah/blogviews/Plugin.php(63): Cms\Classes\ComponentBase->__call('getRouter', Array)
#1 [internal function]: Vdomah\BlogViews\Plugin->Vdomah\BlogViews\{closure}(Object(RainLab\Blog\Components\Post))
#2 /home/andmorew/public_html/vendor/october/rain/src/Extension/ExtendableTrait.php(60): call_user_func(Object(Closure), Object(RainLab\Blog\Components\Post))
#3 /home/andmorew/public_html/vendor/october/rain/src/Extension/Extendable.php(31): October\Rain\Extension\Extendable->extendableConstruct()
#4 /home/andmorew/public_html/modules/cms/classes/ComponentBase.php(98): October\Rain\Extension\Extendable->__construct()
#5 [internal function]: Cms\Classes\ComponentBase->__construct(NULL, Array)
#6 /home/andmorew/public_html/vendor/october/rain/src/Foundation/Maker.php(85): ReflectionClass->newInstanceArgs(Array)
#7 /home/andmorew/public_html/vendor/october/rain/src/Foundation/Maker.php(42): October\Rain\Foundation\Maker->build('\\RainLab\\Blog\\C...', Array)
#8 /home/andmorew/public_html/vendor/october/rain/src/Foundation/Application.php(155): October\Rain\Foundation\Maker->make('\\RainLab\\Blog\\C...', Array)
#9 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(221): October\Rain\Foundation\Application->make('\\RainLab\\Blog\\C...', Array)
#10 /home/andmorew/public_html/modules/cms/classes/ComponentManager.php(213): Illuminate\Support\Facades\Facade::__callStatic('make', Array)
#11 /home/andmorew/public_html/modules/cms/classes/CmsCompoundObject.php(225): Cms\Classes\ComponentManager->makeComponent('blogPost', NULL, Array)
#12 /home/andmorew/public_html/plugins/rainlab/blog/classes/ComponentAbstract.php(35): Cms\Classes\CmsCompoundObject->getComponent('blogPost')
#13 /home/andmorew/public_html/plugins/rainlab/blog/components/Posts.php(222): RainLab\Blog\Classes\ComponentAbstract->getComponent('blogPost', Object(Cms\Classes\Page))
#14 /home/andmorew/public_html/plugins/rainlab/blog/components/Posts.php(169): RainLab\Blog\Components\Posts->listPosts()
#15 /home/andmorew/public_html/modules/cms/classes/CmsCompoundObject.php(172): RainLab\Blog\Components\Posts->onRun()
#16 /home/andmorew/public_html/modules/cms/classes/Controller.php(500): Cms\Classes\CmsCompoundObject->runComponents()
#17 /home/andmorew/public_html/modules/cms/classes/Controller.php(393): Cms\Classes\Controller->execPageCycle()
#18 /home/andmorew/public_html/modules/cms/classes/Controller.php(224): Cms\Classes\Controller->runPage(Object(Cms\Classes\Page))
#19 /home/andmorew/public_html/modules/cms/classes/CmsController.php(50): Cms\Classes\Controller->run('/')
#20 [internal function]: Cms\Classes\CmsController->run('/')
#21 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#22 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('run', Array)
#23 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Cms\Classes\CmsController), 'run')
#24 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\Routing\Route->runController()
#25 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\Routing\Route->run()
#26 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#27 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#28 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#29 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#30 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#31 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#32 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#33 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(63): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#34 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#35 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#36 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#37 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#38 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(66): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#40 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#41 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#42 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#43 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(660): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#44 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#45 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(601): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#46 /home/andmorew/public_html/vendor/october/rain/src/Router/CoreRouter.php(20): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#47 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): October\Rain\Router\CoreRouter->dispatch(Object(Illuminate\Http\Request))
#48 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#49 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#50 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#51 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#52 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#53 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#54 /home/andmorew/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#55 /home/andmorew/public_html/index.php(43): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#56 {main}


205

Answer

Solution:

The issue that I was encountering seems highly similar to the one described here: https://github.com/rainlab/blog-plugin/issues/451

and potentially fixed here: https://github.com/rainlab/blog-plugin/pull/394

I was able (somehow?) to get the site back by editing the component and disabling (for now) a translation module.

As I am not 100% sure what I did, I consider the problem fixed, but not solved.

On to the next bug!

People are also looking for solutions to the problem: javascript - React app using Laravel for API and user login. Question about retrieving currently logged in user from database

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.