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

Array to string conversion error in Debug-Mod #367

Open
mlwebworker opened this issue May 12, 2023 · 6 comments
Open

Array to string conversion error in Debug-Mod #367

mlwebworker opened this issue May 12, 2023 · 6 comments

Comments

@mlwebworker
Copy link

Contao 4.13.23
Catalog-Manager v1.32.35
PHP 8.1.18

Stack-Trace

ErrorException:
Warning: Array to string conversion

  at templates/block_unsearchable.html5:3
  at include('/srv/www/mlweb/public/ml-webseiten.de/projektentwicklung/hebammenlisten/templates/block_unsearchable.html5')
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/TemplateInheritance.php:108)
  at Contao\Template->inherit()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Template.php:295)
  at Contao\Template->parse()
     (vendor/contao/core-bundle/src/Resources/contao/classes/FrontendTemplate.php:43)
  at Contao\FrontendTemplate->parse()
     (vendor/alnv/catalog-manager/library/alnv/CatalogFormFilter.php:200)
  at CatalogManager\CatalogFormFilter->render()
     (vendor/alnv/catalog-manager/library/alnv/Elements/ContentCatalogFilterForm.php:52)
  at CatalogManager\ContentCatalogFilterForm->compile()
     (vendor/contao/core-bundle/src/Resources/contao/elements/ContentElement.php:246)
  at Contao\ContentElement->generate()
     (vendor/alnv/catalog-manager/library/alnv/Elements/ContentCatalogFilterForm.php:46)
  at CatalogManager\ContentCatalogFilterForm->generate()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:621)
  at Contao\Controller::getContentElement()
     (vendor/contao/core-bundle/src/Resources/contao/modules/ModuleArticle.php:197)
  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:70)
  at Contao\ModuleArticle->generate()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:549)
  at Contao\Controller::getArticle()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:391)
  at Contao\Controller::getFrontendModule()
     (vendor/contao/core-bundle/src/Resources/contao/pages/PageRegular.php:190)
  at Contao\PageRegular->prepare()
     (vendor/contao/core-bundle/src/Resources/contao/pages/PageRegular.php:60)
  at Contao\PageRegular->getResponse()
     (vendor/contao/core-bundle/src/Resources/contao/controllers/FrontendIndex.php:320)
  at Contao\FrontendIndex->renderPage()
     (vendor/symfony/http-kernel/HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/preview.php:46) 
@fritzmg
Copy link
Contributor

fritzmg commented May 13, 2023

You seem to have a custom block_unsearchable template. What is its content?

@mlwebworker
Copy link
Author

Nein es gibt kein individuelles Template block_unsearchable von mir.
Was der Catalog-Manager an dieser Stelle tut, habe ich noch nicht genau herausgefunden.

@fritzmg
Copy link
Contributor

fritzmg commented May 13, 2023

Nein es gibt kein individuelles Template block_unsearchable von mir.

According to the error message you are using a custom template:

  at templates/block_unsearchable.html5:3
  at include('/srv/www/mlweb/public/ml-webseiten.de/projektentwicklung/hebammenlisten/templates/block_unsearchable.html5')

@mlwebworker
Copy link
Author

mlwebworker commented May 13, 2023

So gesehen hast Du Recht. Ich habe mir die Variablen angeschaut, die zur Verfügung stehen und wahrscheinlich daraus dann die Fehlermeldung gezogen. Der Fehler tritt aber genauso ohne dieses Template auf.
Hier der Vollständigkeit halber der Code des Templates:

<?php $this->dumpTemplateVars() ?>
<!-- indexer::stop -->
<div class="<?= $this->class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>>

  <?php $this->block('headline'); ?>
    <?php if ($this->headline): ?>
      <<?= $this->hl ?>><?= $this->headline ?></<?= $this->hl ?>>
    <?php endif; ?>
  <?php $this->endblock(); ?>

  <?php $this->block('content'); ?>
  <?php $this->endblock(); ?>

</div>
<!-- indexer::continue -->

@JessesNei
Copy link

I have the same problem and do not have a custom template

ErrorException:
Warning: Array to string conversion

at vendor/contao/core-bundle/src/Resources/contao/templates/block/block_unsearchable.html5:3
at include('/home/httpd/vhosts/omsetzig.ch/websites/kaltbrunn.omsetzig.ch/vendor/contao/core-bundle/src/Resources/contao/templates/block/block_unsearchable.html5')
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/TemplateInheritance.php:108)
at Contao\Template->inherit()
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Template.php:295)
at Contao\Template->parse()
(vendor/contao/core-bundle/src/Resources/contao/classes/FrontendTemplate.php:43)
at Contao\FrontendTemplate->parse()
(vendor/alnv/catalog-manager/library/alnv/CatalogFormFilter.php:200)
at CatalogManager\CatalogFormFilter->render(object(FrontendTemplate))
(vendor/alnv/catalog-manager/library/alnv/Elements/ContentCatalogFilterForm.php:52)
at CatalogManager\ContentCatalogFilterForm->compile()
(vendor/contao/core-bundle/src/Resources/contao/elements/ContentElement.php:246)
at Contao\ContentElement->generate()
(vendor/alnv/catalog-manager/library/alnv/Elements/ContentCatalogFilterForm.php:46)
at CatalogManager\ContentCatalogFilterForm->generate()
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:621)
at Contao\Controller::getContentElement(object(ContentModel), 'main')
(vendor/contao/core-bundle/src/Resources/contao/modules/ModuleArticle.php:197)
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:70)
at Contao\ModuleArticle->generate(false)
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:549)
at Contao\Controller::getArticle(object(ArticleModel), true, false, 'main')
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:391)
at Contao\Controller::getFrontendModule('0', 'main')
(vendor/contao/core-bundle/src/Resources/contao/pages/PageRegular.php:190)
at Contao\PageRegular->prepare(object(PageModel))
(vendor/contao/core-bundle/src/Resources/contao/pages/PageRegular.php:60)
at Contao\PageRegular->getResponse(object(PageModel), true)
(vendor/contao/core-bundle/src/Resources/contao/controllers/FrontendIndex.php:320)
at Contao\FrontendIndex->renderPage(object(PageModel))
(vendor/symfony/http-kernel/HttpKernel.php:163)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/http-kernel/HttpKernel.php:75)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/http-kernel/Kernel.php:202)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(web/index.php:44)

Contao 4.13.23
CM: v1.32.35
PHP 8.1

 Actually, there are a lot more warnings everywhere also in the backend.

@fritzmg
Copy link
Contributor

fritzmg commented May 28, 2024

This error also occurs with the regular block_ templates. The reason is that ContentCatalogFilterForm executes

$this->objForm->render( $this->Template );

in its compile() method. However, at this point $this->Template does not yet have the correct template variables set. This would happen after the compile() method is called by parent::generate().

I don't quite understand how ContentCatalogFilterForm is supposed to work. $this->objForm->render( $this->Template ); would return the rendered template of the form - however, this is then never used.

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

3 participants