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

TypeError when reparenting a page without Flex Objects #2019

Closed
newbthenewbd opened this issue Jan 16, 2021 · 0 comments
Closed

TypeError when reparenting a page without Flex Objects #2019

newbthenewbd opened this issue Jan 16, 2021 · 0 comments
Assignees

Comments

@newbthenewbd
Copy link
Contributor

With the latest committed versions of Grav 1.7 and Grav Admin 1.10, the following error pops up if Flex Objects is disabled for pages and an attempt is made to change a page's parent, unless the new parent is either root or the homepage:

[2021-01-16 09:16:42] grav.CRITICAL: Argument 1 passed to Grav\Common\Page\Page::move() must implement interface Grav\Common\Page\Interfaces\PageInterface, null given, called in /var/www/site/user/plugins/admin/classes/plugin/AdminController.php on line 1366 - Trace: #0 /var/www/site/user/plugins/admin/classes/plugin/AdminController.php(1366): Grav\Common\Page\Page->move(NULL) #1 /var/www/site/user/plugins/admin/classes/plugin/AdminController.php(145): Grav\Plugin\Admin\AdminController->taskSavePage() #2 /var/www/site/user/plugins/admin/classes/plugin/AdminBaseController.php(119): Grav\Plugin\Admin\AdminController->taskSave() #3 /var/www/site/user/plugins/admin/admin.php(1011): Grav\Plugin\Admin\AdminBaseController->execute() #4 /var/www/site/user/plugins/admin/admin.php(515): Grav\Plugin\AdminPlugin->initializeController('save', Array) #5 /var/www/site/vendor/symfony/event-dispatcher/EventDispatcher.php(264): Grav\Plugin\AdminPlugin->onPagesInitialized(Object(RocketTheme\Toolbox\Event\Event), 'onPagesInitiali...', Object(Symfony\Component\EventDispatcher\EventDispatcher)) #6 /var/www/site/vendor/symfony/event-dispatcher/EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'onPagesInitiali...', Object(RocketTheme\Toolbox\Event\Event)) #7 /var/www/site/vendor/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'onPagesInitiali...', Object(RocketTheme\Toolbox\Event\Event)) #8 /var/www/site/system/src/Grav/Common/Grav.php(537): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(RocketTheme\Toolbox\Event\Event), 'onPagesInitiali...') #9 /var/www/site/system/src/Grav/Common/Processors/PagesProcessor.php(43): Grav\Common\Grav->fireEvent('onPagesInitiali...', Object(RocketTheme\Toolbox\Event\Event)) #10 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\PagesProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #11 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #12 /var/www/site/system/src/Grav/Common/Processors/TwigProcessor.php(38): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #13 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\TwigProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #14 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #15 /var/www/site/system/src/Grav/Common/Processors/AssetsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #16 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\AssetsProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #17 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #18 /var/www/site/system/src/Grav/Common/Processors/SchedulerProcessor.php(40): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #19 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\SchedulerProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #20 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #21 /var/www/site/system/src/Grav/Common/Processors/BackupsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #22 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\BackupsProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #23 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #24 /var/www/site/system/src/Grav/Common/Processors/TasksProcessor.php(69): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #25 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\TasksProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #26 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #27 /var/www/site/user/plugins/admin/classes/plugin/Router.php(51): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #28 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Plugin\Admin\Router->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #29 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #30 /var/www/site/system/src/Grav/Common/Processors/RequestProcessor.php(63): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #31 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\RequestProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #32 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #33 /var/www/site/system/src/Grav/Common/Processors/ThemesProcessor.php(38): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #34 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\ThemesProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #35 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #36 /var/www/site/system/src/Grav/Common/Processors/PluginsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #37 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\PluginsProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #38 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #39 /var/www/site/system/src/Grav/Common/Processors/InitializeProcessor.php(128): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #40 /var/www/site/system/src/Grav/Common/Debugger.php(545): Grav\Common\Processors\InitializeProcessor::Grav\Common\Processors\{closure}() #41 /var/www/site/system/src/Grav/Common/Processors/InitializeProcessor.php(129): Grav\Common\Debugger->profile(Object(Closure)) #42 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\InitializeProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #43 /var/www/site/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #44 /var/www/site/system/src/Grav/Common/Grav.php(282): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #45 /var/www/site/index.php(58): Grav\Common\Grav->process() #46 {main} [] []

I attach a minimal test case using the latest committed versions of everything. The error pops up when you try to change the parent of /home/test to /nonhome, but doesn't when you try to change the parent to <root>, or back to /home. Interestingly, for all pages but the configured homepage, only the page slug serves for page identification, but the homepage has its title shown - although I am not sure if this is related to the issue.

(If paying particular attention, you might have noticed that I have earlier called off the issue in a comment to #2007. What happened there is I had right then only happened to hastily test for it using a child of the homepage, moved to root and back - without yet realizing that it's pretty much the only case in which the issue doesn't occur...)

Thank You!

user.zip

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

2 participants