catalog-manager icon indicating copy to clipboard operation
catalog-manager copied to clipboard

Array to string conversion error in Debug-Mod

Open mlwebworker opened this issue 1 year ago • 7 comments

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) 

mlwebworker avatar May 12 '23 12:05 mlwebworker

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

fritzmg avatar May 13 '23 10:05 fritzmg

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

mlwebworker avatar May 13 '23 11:05 mlwebworker

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')

fritzmg avatar May 13 '23 11:05 fritzmg

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 -->

mlwebworker avatar May 13 '23 12:05 mlwebworker

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.

JessesNei avatar May 23 '23 13:05 JessesNei

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.

fritzmg avatar May 28 '24 13:05 fritzmg

Debug is throwing me the same error

Warning: Array to string conversion

  at C:\laragon\www\contao413\vendor\contao\core-bundle\src\Resources\contao\templates\block\block_unsearchable.html5:3
  at include('C:\\laragon\\www\\contao413\\vendor\\contao\\core-bundle\\src\\Resources\\contao\\templates\\block\\block_unsearchable.html5')
     (C:\laragon\www\contao413\vendor\contao\core-bundle\src\Resources\contao\library\Contao\TemplateInheritance.php:108)
  at Contao\Template->inherit()
     (C:\laragon\www\contao413\vendor\contao\core-bundle\src\Resources\contao\library\Contao\Template.php:324)
  at Contao\Template->parse()
     (C:\laragon\www\contao413\vendor\contao\core-bundle\src\Resources\contao\classes\FrontendTemplate.php:43)
  at Contao\FrontendTemplate->parse()
     (C:\laragon\www\contao413\vendor\alnv\catalog-manager\library\alnv\CatalogFormFilter.php:205)
  at CatalogManager\CatalogFormFilter->render(object(FrontendTemplate))
     (C:\laragon\www\contao413\vendor\alnv\catalog-manager\library\alnv\Elements\ContentCatalogFilterForm.php:55)
  at CatalogManager\ContentCatalogFilterForm->compile()
     (C:\laragon\www\contao413\vendor\contao\core-bundle\src\Resources\contao\elements\ContentElement.php:246)
  at Contao\ContentElement->generate()
     (C:\laragon\www\contao413\vendor\alnv\catalog-manager\library\alnv\Elements\ContentCatalogFilterForm.php:48)
  at CatalogManager\ContentCatalogFilterForm->generate()
     (C:\laragon\www\contao413\vendor\contao\core-bundle\src\Resources\contao\library\Contao\Controller.php:623)
  at Contao\Controller::getContentElement(object(ContentModel), 'main')
     (C:\laragon\www\contao413\vendor\contao\core-bundle\src\Resources\contao\modules\ModuleArticle.php:197)
  at Contao\ModuleArticle->compile()
     (C:\laragon\www\contao413\vendor\contao\core-bundle\src\Resources\contao\modules\Module.php:214)
  at Contao\Module->generate()
     (C:\laragon\www\contao413\vendor\contao\core-bundle\src\Resources\contao\modules\ModuleArticle.php:70)
  at Contao\ModuleArticle->generate(false)
     (C:\laragon\www\contao413\vendor\contao\core-bundle\src\Resources\contao\library\Contao\Controller.php:551)
  at Contao\Controller::getArticle(object(ArticleModel), false, false, 'main')
     (C:\laragon\www\contao413\vendor\contao\core-bundle\src\Resources\contao\library\Contao\Controller.php:393)
  at Contao\Controller::getFrontendModule('0', 'main')
     (C:\laragon\www\contao413\vendor\contao\core-bundle\src\Resources\contao\pages\PageRegular.php:194)
  at Contao\PageRegular->prepare(object(PageModel))
     (C:\laragon\www\contao413\vendor\contao\core-bundle\src\Resources\contao\pages\PageRegular.php:61)
  at Contao\PageRegular->getResponse(object(PageModel), true)
     (C:\laragon\www\contao413\vendor\contao\core-bundle\src\Resources\contao\controllers\FrontendIndex.php:320)
  at Contao\FrontendIndex->renderPage(object(PageModel))
     (C:\laragon\www\contao413\vendor\symfony\http-kernel\HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (C:\laragon\www\contao413\vendor\symfony\http-kernel\HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (C:\laragon\www\contao413\vendor\symfony\http-kernel\Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (C:\laragon\www\contao413\public\index.php:44)            ```

svharsdorf avatar Sep 08 '24 14:09 svharsdorf