strlen() expects parameter 1 to be string, null given
Closed this issue · 7 comments
akroii commented
Bug description
After updating from 3.4.1 to 3.4.2 it causes an error:
TypeError:
strlen() expects parameter 1 to be string, null given
at vendor/pdir/contao-survey/src/Resources/contao/elements/ContentSurvey.php:88
at Hschottm\SurveyBundle\ContentSurvey->compile()
(vendor/contao/core-bundle/src/Resources/contao/elements/ContentElement.php:252)
at Contao\ContentElement->generate()
(vendor/pdir/contao-survey/src/Resources/contao/elements/ContentSurvey.php:66)
at Hschottm\SurveyBundle\ContentSurvey->generate()
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:624)
at Contao\Controller::getContentElement(object(ContentModel), 'main')
(vendor/contao/core-bundle/src/Resources/contao/modules/ModuleArticle.php:218)
at Contao\ModuleArticle->compile()
(vendor/contao/core-bundle/src/Resources/contao/modules/Module.php:214)
at Contao\Module->generate()
(vendor/contao/core-bundle/src/Resources/contao/modules/ModuleArticle.php:71)
at Contao\ModuleArticle->generate(false)
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:552)
at Contao\Controller::getArticle(object(ArticleModel), false, false, 'main')
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:393)
at Contao\Controller::getFrontendModule(0, 'main')
(vendor/fritzmg/contao-inherit-article/src/EventListener/InheritArticleListener.php:50)
at InheritArticleBundle\EventListener\InheritArticleListener->getRenderedInheritedArticles(88, 'main')
(vendor/fritzmg/contao-inherit-article/src/EventListener/InheritArticleListener.php:41)
at InheritArticleBundle\EventListener\InheritArticleListener->onGetArticles(88, 'main')
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:348)
at Contao\Controller::getFrontendModule('0', 'main')
(vendor/contao/core-bundle/src/Resources/contao/pages/PageRegular.php:173)
at Contao\PageRegular->prepare(object(PageModel))
(vendor/contao/core-bundle/src/Resources/contao/pages/PageRegular.php:53)
at Contao\PageRegular->getResponse(object(PageModel), true)
(vendor/contao/core-bundle/src/Resources/contao/controllers/FrontendIndex.php:343)
at Contao\FrontendIndex->renderPage(object(PageModel))
(vendor/symfony/http-kernel/HttpKernel.php:169)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/http-kernel/HttpKernel.php:81)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/http-kernel/Kernel.php:201)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(web/index.php:31)
Steps to reproduce
Its important to have an existing survey on page
Expected behavior
The page which containing the survey should be displayed without any error.
Screenshots
Environment
C4.9.33
Survey: 3.4.2
PHP 7.4
MDevster commented
@akroii Can you test if
$surveyID = isset(Input::post('survey')) ? Input::post('survey') : $this->survey;
helps? I don't have an installation here right now. That would then surely have to be changed on all positions with \strlen(Input::post(...));
.
akroii commented
I've changed a few lines in resources/ContentSurvey.php and dca/tl_survey_page.php with !empty()
instead of isset()
and it worked. Not sure the whole extension works correctly.
fritzmg commented
MDevster commented
Fixed in version 3.4.3. Thank you both!