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

Form::getPage() throws error instead of returning null if page has not been initialized yet #3310

Closed
pamtbaau opened this issue Apr 12, 2021 · 1 comment

Comments

@pamtbaau
Copy link
Contributor

According the docs:

public getPage() : \Grav\Common\Page\Markdown\PageInterface/null

Form::getPage() should either returns a page or null. However, when page has not been initialized yet, Grav throws an error:

Return value of Grav\Plugin\Form\Form::getPage() must implement interface Grav\Common\Page\Interfaces\PageInterface, null returned

Stacktrace:

[2021-04-12 17:40:09] grav.CRITICAL: Return value of Grav\Plugin\Form\Form::getPage() must implement interface Grav\Common\Page\Interfaces\PageInterface, null returned -
Trace:
#0 /path/to/user/plugins/qq/qq.php(78): Grav\Plugin\Form\Form->getPage()
#1 /path/to/vendor/symfony/event-dispatcher/EventDispatcher.php(264): Grav\Plugin\QqPlugin->onFormInitialized()
#2 /path/to/vendor/symfony/event-dispatcher/EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch()
#3 /path/to/vendor/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#4 /path/to/system/src/Grav/Common/Grav.php(556): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#5 /path/to/user/plugins/form/classes/Form.php(203): Grav\Common\Grav->fireEvent()
#6 /path/to/user/plugins/form/classes/Form.php(175): Grav\Plugin\Form\Form->initialize()
#7 /path/to/user/plugins/form/classes/FormFactory.php(38): Grav\Plugin\Form\Form->__construct()
#8 /path/to/user/plugins/form/classes/Forms.php(79): Grav\Plugin\Form\FormFactory->createFormForPage()
#9 /path/to/user/plugins/form/form.php(197): Grav\Plugin\Form\Forms->createPageForm()
#10 /path/to/vendor/symfony/event-dispatcher/EventDispatcher.php(264): Grav\Plugin\FormPlugin->onPageProcessed()
#11 /path/to/vendor/symfony/event-dispatcher/EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch()
#12 /path/to/vendor/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#13 /path/to/system/src/Grav/Common/Grav.php(556): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#14 /path/to/system/src/Grav/Common/Page/Pages.php(1822): Grav\Common\Grav->fireEvent()
#15 /path/to/system/src/Grav/Common/Page/Pages.php(1841): Grav\Common\Page\Pages->recurse()
#16 /path/to/system/src/Grav/Common/Page/Pages.php(1841): Grav\Common\Page\Pages->recurse()
#17 /path/to/system/src/Grav/Common/Page/Pages.php(1701): Grav\Common\Page\Pages->recurse()
#18 /path/to/system/src/Grav/Common/Page/Pages.php(1690): Grav\Common\Page\Pages->resetPages()
#19 /path/to/system/src/Grav/Common/Page/Pages.php(1478): Grav\Common\Page\Pages->buildRegularPages()
#20 /path/to/system/src/Grav/Common/Page/Pages.php(315): Grav\Common\Page\Pages->buildPages()
#21 /path/to/system/src/Grav/Common/Processors/PagesProcessor.php(42): Grav\Common\Page\Pages->init()
#22 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\PagesProcessor->process()
#23 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle()
#24 /path/to/system/src/Grav/Common/Processors/TwigProcessor.php(38): Grav\Framework\RequestHandler\RequestHandler->handle()
#25 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\TwigProcessor->process()
#26 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle()
#27 /path/to/system/src/Grav/Common/Processors/AssetsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle()
#28 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\AssetsProcessor->process()
#29 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle()
#30 /path/to/system/src/Grav/Common/Processors/SchedulerProcessor.php(40): Grav\Framework\RequestHandler\RequestHandler->handle()
#31 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\SchedulerProcessor->process()
#32 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle()
#33 /path/to/system/src/Grav/Common/Processors/BackupsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle()
#34 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\BackupsProcessor->process()
#35 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle()
#36 /path/to/system/src/Grav/Common/Processors/TasksProcessor.php(69): Grav\Framework\RequestHandler\RequestHandler->handle()
#37 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\TasksProcessor->process()
#38 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle()
#39 /path/to/system/src/Grav/Common/Processors/RequestProcessor.php(63): Grav\Framework\RequestHandler\RequestHandler->handle()
#40 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\RequestProcessor->process()
#41 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle()
#42 /path/to/system/src/Grav/Common/Processors/ThemesProcessor.php(38): Grav\Framework\RequestHandler\RequestHandler->handle()
#43 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\ThemesProcessor->process()
#44 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle()
#45 /path/to/system/src/Grav/Common/Processors/PluginsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle()
#46 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\PluginsProcessor->process()
#47 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle()
#48 /path/to/system/src/Grav/Common/Processors/InitializeProcessor.php(130): Grav\Framework\RequestHandler\RequestHandler->handle()
#49 /path/to/system/src/Grav/Common/Debugger.php(546): Grav\Common\Processors\InitializeProcessor::Grav\Common\Processors{closure}()
#50 /path/to/system/src/Grav/Common/Processors/InitializeProcessor.php(131): Grav\Common\Debugger->profile()
#51 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\InitializeProcessor->process()
#52 /path/to/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle()
#53 /path/to/system/src/Grav/Common/Grav.php(295): Grav\Framework\RequestHandler\RequestHandler->handle()
#54 /path/to/index.php(58): Grav\Common\Grav->process()
#55 {main} [] []

@pamtbaau pamtbaau changed the title Form::getPage() throws error instead of null if page has not been initialized yet Form::getPage() throws error instead instead of null if page has not been initialized yet Apr 12, 2021
@pamtbaau pamtbaau changed the title Form::getPage() throws error instead instead of null if page has not been initialized yet Form::getPage() throws error instead of returning null if page has not been initialized yet Apr 12, 2021
@pamtbaau
Copy link
Contributor Author

Should be issues at form plugin

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

No branches or pull requests

1 participant