oveleon / contao-component-style-manager

This extension is for the Contao CMS and allows you to easily manage and provide custom categories and groups for CSS classes.
MIT License
23 stars 6 forks source link

PHP error on stylemanager export #108

Closed delirius closed 3 months ago

delirius commented 3 months ago

Prerequisites

Please select the topic(s) that most closely match your concern

Backend (PHP/CSS)

Description

Beim Exportieren aus den StyleManager kommt ein Internal Server Error. Contao 5.3.12 Komponenten StyleManager 3.6.1 PHP 8.2.*

image

Testweise habe ich eine Konvertierung zu String hinzugefügt, so klappt es bei mir wieder. src/StyleManager/Sync.php Zeile 402: $value = $xml->createTextNode((string) $v);

Relevant log output

TypeError:
DOMDocument::createTextNode(): Argument #1 ($data) must be of type string, int given

  at vendor/oveleon/contao-component-style-manager/src/StyleManager/Sync.php:402
  at DOMDocument->createTextNode(3)
     (vendor/oveleon/contao-component-style-manager/src/StyleManager/Sync.php:402)
  at Oveleon\ContaoComponentStyleManager\StyleManager\Sync->addRowData(object(DOMDocument), object(DOMElement), array('id' => 3, 'tstamp' => 1723215542, 'title' => 'Artikel Hintergrund', 'desc' => null, 'identifier' => 'hintergrund', 'groupAlias' => 'section', 'sorting' => 256))
     (vendor/oveleon/contao-component-style-manager/src/StyleManager/Sync.php:347)
  at Oveleon\ContaoComponentStyleManager\StyleManager\Sync->addArchiveData(object(DOMDocument), object(DOMElement), object(Collection))
     (vendor/oveleon/contao-component-style-manager/src/StyleManager/Sync.php:315)
  at Oveleon\ContaoComponentStyleManager\StyleManager\Sync->export(object(DC_Table))
     (vendor/contao/core-bundle/contao/classes/Backend.php:321)
  at Contao\Backend->getBackendModule('style_manager', null)
     (vendor/contao/core-bundle/contao/controllers/BackendMain.php:144)
  at Contao\BackendMain->run()
     (vendor/contao/core-bundle/src/Controller/BackendController.php:44)
  at Contao\CoreBundle\Controller\BackendController->mainAction()
     (vendor/symfony/http-kernel/HttpKernel.php:181)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:76)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:197)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (public/index.php:42)
zoglo commented 3 months ago

@delirius could you send me the a dump with the stylemanager tables to sebastian@oveleon.de?

I assume you used labels that are saved as numbers but I'd rather wanna test it on my end with a proper PHPStan configuration set up.

Also, tell me if the branch dev-fix/export fixes your issue

zoglo commented 3 months ago

@delirius The reason why this happens all of the sudden was me introducing declare(strict_types=1) for strict type checking.

Removing the check can be compared to ignoring the burning house.

I consider this being many bugs where the style manager did falsely use wrong types (e.g. an integer to an array value (See #107))