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

Typed static property verbb\supertable\SuperTable::$plugin must not be accessed before initialization #549

Closed
MatthiasBrodelet opened this issue Mar 12, 2024 · 2 comments

Comments

@MatthiasBrodelet
Copy link

Describe the bug

An error in the plugin breaks my whole website.

2024-03-12 10:55:08 [web.ERROR] [Error] Typed static property verbb\supertable\SuperTable::$plugin must not be accessed before initialization {"trace":["#0 /var/www/vhosts/clientwebsite.com/vendor/verbb/super-table/src/fields/SuperTableField.php(275): verbb\supertable\fields\SuperTableField->getBlockTypes()","#1 /var/www/vhosts/clientwebsite.com/vendor/verbb/super-table/src/elements/db/SuperTableBlockQuery.php(511): verbb\supertable\fields\SuperTableField->getBlockTypeFields()","#2 /var/www/vhosts/clientwebsite.com/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1411): verbb\supertable\elements\db\SuperTableBlockQuery->customFields()","#3 /var/www/vhosts/clientwebsite.com/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare()","#4 /var/www/vhosts/clientwebsite.com/vendor/yiisoft/yii2/db/Query.php(157): yii\db\QueryBuilder->build()","#5 /var/www/vhosts/clientwebsite.com/vendor/yiisoft/yii2/db/Query.php(249): yii\db\Query->createCommand()","#6 /var/www/vhosts/clientwebsite.com/vendor/craftcms/cms/src/db/Query.php(247): yii\db\Query->all()","#7 /var/www/vhosts/clientwebsite.com/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1590): craft\db\Query->all()","#8 /var/www/vhosts/clientwebsite.com/vendor/craftcms/cms/src/services/Elements.php(3036): craft\elements\db\ElementQuery->all()","#9 /var/www/vhosts/clientwebsite.com/vendor/craftcms/cms/src/services/Elements.php(2914): craft\services\Elements->_eagerLoadElementsInternal()","#10 /var/www/vhosts/clientwebsite.com/vendor/twig/twig/src/Extension/CoreExtension.php(1607): craft\services\Elements->eagerLoadElements()","#11 /var/www/vhosts/clientwebsite.com/vendor/craftcms/cms/src/helpers/Template.php(129): twig_get_attribute()","#12 /var/www/vhosts/clientwebsite.com/storage/runtime/compiled_templates/3f/3f0f4db9beea24d00a840cd6441e4acc.php(48): craft\helpers\Template::attribute()","#13 /var/www/vhosts/clientwebsite.com/vendor/twig/twig/src/Template.php(394): __TwigTemplate_255c5199bcda0e5ba65f82887be4e13e->doDisplay()","#14 /var/www/vhosts/clientwebsite.com/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()","#15 /var/www/vhosts/clientwebsite.com/vendor/twig/twig/src/Template.php(379): Twig\Template->display()","#16 /var/www/vhosts/clientwebsite.com/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render()","#17 /var/www/vhosts/clientwebsite.com/vendor/twig/twig/src/Environment.php(277): Twig\TemplateWrapper->render()","#18 /var/www/vhosts/clientwebsite.com/vendor/craftcms/cms/src/web/View.php(482): Twig\Environment->render()","#19 /var/www/vhosts/clientwebsite.com/vendor/craftcms/cms/src/web/View.php(535): craft\web\View->renderTemplate()","#20 /var/www/vhosts/clientwebsite.com/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(57): craft\web\View->renderPageTemplate()","#21 /var/www/vhosts/clientwebsite.com/vendor/yiisoft/yii2/web/Response.php(1100): craft\web\TemplateResponseFormatter->format()","#22 /var/www/vhosts/clientwebsite.com/vendor/craftcms/cms/src/web/Response.php(337): yii\web\Response->prepare()","#23 /var/www/vhosts/clientwebsite.com/vendor/yiisoft/yii2/web/Response.php(340): craft\web\Response->prepare()","#24 /var/www/vhosts/clientwebsite.com/vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()","#25 /var/www/vhosts/clientwebsite.com/web/index.php(12): yii\base\Application->run()","#26 {main}"],"memory":13101896,"exception":"[object] (Error(code: 0): Typed static property verbb\supertable\SuperTable::$plugin must not be accessed before initialization at /var/www/vhosts/clientwebsite.com/vendor/verbb/super-table/src/fields/SuperTableField.php:260)"}

Steps to reproduce

  1. Install latest version on the plugin

Craft CMS version

4.7.1

Plugin version

3.0.12

Multi-site?

No response

Additional context

Only on production

@MatthiasBrodelet
Copy link
Author

I was able to "fix" the issue by setting COMPOSER_ALLOW_SUPERUSER to 1 in my deployment pipeline.
Not sure what it does and what it changes but it works.

@engram-design
Copy link
Member

I'm not exactly sure what's happened here, but it sounds like something is trying to access the Super Table plugin before it's been initialized by Craft.

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

2 participants