inspiredminds/contao-wowjs

after update to 4.7.2 error preg_match()

Closed this issue · 5 comments

after update to 4.7.2 you can't edit articles.

Log Error:
[2019-04-03 15:12:41] request.CRITICAL: Uncaught PHP Exception TypeError: "preg_match() expects parameter 2 to be string, null given" at /var/www/html/.../vendor/contao/core-bundle/src/DataContainer/PaletteManipulator.php line 199 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): preg_match() expects parameter 2 to be string, null given at /var/www/html/.../vendor/contao/core-bundle/src/DataContainer/PaletteManipulator.php:199)"} []

app_dev | TypeError in

in vendor/inspiredminds/contao-wowjs/src/Resources/contao/dca/tl_content.php->applyToPalette (line 190) ->applyToPalette($key, 'tl_content');

After uninstalling this package, it worked again.

Are you still maintaining this package?

I am unable to reproduce the error. Can you please post the complete stack trace?

TypeError:
preg_match() expects parameter 2 to be string, null given

  at vendor/contao/core-bundle/src/DataContainer/PaletteManipulator.php:199
  at preg_match('#\\{(.+?)(:hide)?\\}#', null, array('{data_attributes_legend}', 'data_attributes_legend'))
     (vendor/contao/core-bundle/src/DataContainer/PaletteManipulator.php:199)
  at Contao\CoreBundle\DataContainer\PaletteManipulator->explode('{type_legend},type;{data_attributes_legend},add_data_attributes;')
     (vendor/contao/core-bundle/src/DataContainer/PaletteManipulator.php:139)
  at Contao\CoreBundle\DataContainer\PaletteManipulator->applyToString('{type_legend},type;{data_attributes_legend},add_data_attributes;')
     (vendor/contao/core-bundle/src/DataContainer/PaletteManipulator.php:119)
  at Contao\CoreBundle\DataContainer\PaletteManipulator->applyToPalette('default', 'tl_content')
     (vendor/inspiredminds/contao-wowjs/src/Resources/contao/dca/tl_content.php:190)
  at Contao\DcaLoader->{closure}(object(DC_Table))
     (vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Table.php:207)
  at Contao\DC_Table->__construct('tl_content', array('tables' => array('tl_article', 'tl_content'), 'table' => array('contao.controller.backend_csv_import', 'importTableWizardAction'), 'list' => array('contao.controller.backend_csv_import', 'importListWizardAction')))
     (vendor/contao/core-bundle/src/Resources/contao/classes/Backend.php:397)
  at Contao\Backend->getBackendModule('article', null)
     (vendor/contao/core-bundle/src/Resources/contao/controllers/BackendMain.php:169)
  at Contao\BackendMain->run()
     (vendor/contao/core-bundle/src/Controller/BackendController.php:48)
  at Contao\CoreBundle\Controller\BackendController->mainAction()
     (vendor/symfony/http-kernel/HttpKernel.php:150)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:67)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:198)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (web/app_dev.php:83)

This error is caused by the add_data_attributes extension, which creates an invalid palette. You need to tell the developer of the extension to make the following change in dca/tl_content.php:

-        $GLOBALS['TL_DCA']['tl_content']['palettes'][$key] .= ';{data_attributes_legend},add_data_attributes;';
+        $GLOBALS['TL_DCA']['tl_content']['palettes'][$key] .= ';{data_attributes_legend},add_data_attributes';

(or just adjust it yourself)

Thanks for your help!