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

Error after cache warmup: [] operator not supported for strings #107

Open
rustykowski opened this issue Oct 8, 2024 · 11 comments
Open

Error after cache warmup: [] operator not supported for strings #107

rustykowski opened this issue Oct 8, 2024 · 11 comments

Comments

@rustykowski
Copy link

Contao 4.13.49
contao-events_subscriptions 2.16.4

Exception in file var/cache/prod/contao/dca/tl_member.php on line 224[] operator not supported for strings

The content of line 224 is:
$GLOBALS['TL_DCA']['tl_member']['palettes']['__selector__'][] = 'subscription_enableLimit';

stacktrace:

#0 vendor/contao/core-bundle/src/Resources/contao/library/Contao/DcaLoader.php(105): include()
#1 vendor/contao/core-bundle/src/Resources/contao/library/Contao/DcaLoader.php(75): Contao\DcaLoader->loadDcaFiles(false)
#2 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php(1454): Contao\DcaLoader->load()
#3 vendor/contao/core-bundle/src/Migration/Version413/BooleanFieldsMigration.php(89): Contao\Controller::loadDataContainer('tl_member')
#4 vendor/contao/core-bundle/src/Migration/Version413/BooleanFieldsMigration.php(44): Contao\CoreBundle\Migration\Version413\BooleanFieldsMigration->getTargets()
#5 vendor/contao/core-bundle/src/Migration/MigrationCollection.php(47): Contao\CoreBundle\Migration\Version413\BooleanFieldsMigration->shouldRun()
#6 vendor/contao/core-bundle/src/Migration/MigrationCollection.php(58): Contao\CoreBundle\Migration\MigrationCollection->getPending()
#7 vendor/contao/core-bundle/src/Command/MigrateCommand.php(262): Contao\CoreBundle\Migration\MigrationCollection->getPendingNames()
#8 vendor/contao/core-bundle/src/Command/MigrateCommand.php(209): Contao\CoreBundle\Command\MigrateCommand->executeMigrations(true, true, NULL)
#9 vendor/contao/core-bundle/src/Command/MigrateCommand.php(109): Contao\CoreBundle\Command\MigrateCommand->executeCommand(Object(Symfony\Component\Console\Input\ArgvInput))
#10 vendor/symfony/console/Command/Command.php(298): Contao\CoreBundle\Command\MigrateCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 vendor/symfony/console/Application.php(1058): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 vendor/symfony/framework-bundle/Console/Application.php(96): Symfony\Component\Console\Application->doRunCommand(Object(Contao\CoreBundle\Command\MigrateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 vendor/symfony/console/Application.php(301): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(Object(Contao\CoreBundle\Command\MigrateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 vendor/contao/manager-bundle/bin/contao-console(38): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
#17 {main}
@qzminski
Copy link
Member

qzminski commented Oct 8, 2024

Have you got any other extensions installed? The __selector__ should never be a string.

@rustykowski
Copy link
Author

yes, a few:

        "bugbuster/contao-visitors-bundle": "^1.8",
        "codefog/contao-cookiebar": "^2.5",
        "codefog/contao-events_subscriptions": "^2.16.3",
        "contao/calendar-bundle": "4.13.*",
        "contao/conflicts": "*@dev",
        "contao/manager-bundle": "4.13.*",
        "contao/news-bundle": "4.13.*",
        "contao/newsletter-bundle": "4.13.*",
        "dklemmt/contao_dk_mmenu": "^3.2",
        "do-while/contao-backupdb-bundle": "^1.5",
        "inspiredminds/contao-glightbox": "^1.0",
        "jrgregory/m17-sticky-backend-footer": "^2.0",
        "madeyourday/contao-rocksolid-custom-elements": "^2.4",
        "terminal42/contao-easy_themes": "^3.0",
        "terminal42/contao-pageimage": "^4.1",
        "terminal42/notification_center": "^1.6",
        "thescrat/contao-loginlink": "^1.0"

@rustykowski
Copy link
Author

the last updated first-level dependency was thescrat/contao-loginlink

image

@qzminski
Copy link
Member

qzminski commented Oct 9, 2024

Honestly I don't think error is coming from my extension. There must be a different extension that modifies the __selector__ to be a string, whereas it must be an array. Is there any custom code in your app?

@thescrat
Copy link

thescrat commented Oct 10, 2024

Honestly I don't think error is coming from my extension. There must be a different extension that modifies the __selector__ to be a string, whereas it must be an array. Is there any custom code in your app?

I think the error is caused by your extension. The error message says that the selector is wrong. The selector must be an array and the index should be a string.

So you can fix the error by doing this:
$GLOBALS['TL_DCA']['tl_member']['palettes']['__selector__']['subscription_enableLimit'] = 'subscription_enableLimit';

@aschempp
Copy link

The selector must be an array and the index should be a string.

The selector already is an array: https://github.com/codefog/contao-events_subscriptions/blob/master/dca/tl_member.php#L26

The key is not relevant, as you can see in any Contao core file: https://github.com/contao/contao/blob/5.x/core-bundle/contao/dca/tl_member.php#L85

@qzminski
Copy link
Member

To dump what's causing an error, you could try to dump the selector in file var/cache/prod/contao/dca/tl_member.php on line 223 (!):

dd($GLOBALS['TL_DCA']['tl_member']['palettes']['__selector__']);

@rustykowski
Copy link
Author

I've discovered the following warning:

Warning: Array to string conversion {"exception":"[object] (ErrorException(code: 0): Warning: Array to string conversion at /www/htdocs/.../var/cache/prod/contao/dca/tl_member.php:152)"} []

The relevant line (2nd line) is:

namespace {
$GLOBALS['TL_DCA']['tl_member']['palettes'] = \str_replace('{account_legend}', '{loginLink_legend},loginLink,loginLinkGen;{account_legend}', $GLOBALS['TL_DCA']['tl_member']['palettes']);
\array_insert($GLOBALS['TL_DCA']['tl_member']['fields'], \count($GLOBALS['TL_DCA']['tl_member']['fields']), array('loginLink' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['loginLink'], 'inputType' => 'text', 'eval' => array('minlength' => 10, 'unique' => \true, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'loginLinkGen' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['loginLinkGen'], 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'clr', 'submitOnChange' => \true), 'save_callback' => array(array('tl_loginLink', 'loginLinkGen')), 'sql' => "int(1) unsigned NOT NULL default '0'")));

Can you recognize anything from this?

@rustykowski
Copy link
Author

sorry, @qzminski
this is a problem with contao-loginlink V. 1.0.11, the problem disappears after a downgrade.

@thescrat
Copy link

Dann stammt das doch aus meiner Erweiterung. In der Master besteht der Fehler nicht, nur im Branch der 4.13, da hier noch nicht mit dem PaletteManipulator gearbeitet wurde. Hab gerade nen neues Release veröffentlich 1.0.12 (ist exakt der Stand aus der Master). Probier das mal aus @rustykowski

@rustykowski
Copy link
Author

ja, sehr gut, kein warmup-Fehler mehr.
Danke @thescrat!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants