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

Type error exception when viewing campaigns #284

Closed
bossanova808 opened this issue Dec 6, 2021 · 5 comments
Closed

Type error exception when viewing campaigns #284

bossanova808 opened this issue Dec 6, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@bossanova808
Copy link

bossanova808 commented Dec 6, 2021

Describe the bug

Hey Ben - when viewing any Campaign, I have suddenly started to get an exception.

I am pretty sure it is this issue: craftcms/cms#10208 - moving to the dev-develop of Craft solves it and allows the campaigns to load again. I'll let you and Brandon duke out who should be fixing what ;)

TypeError: Argument 1 passed to craft\web\twig\variables\Cp::field() must be of the type string, null given, called in /var/www/vhosts/c3-dev/vendor/twig/twig/src/Extension/CoreExtension.php on line 1511 and defined in /var/www/vhosts/c3-dev/vendor/craftcms/cms/src/web/twig/variables/Cp.php:811
Stack trace:
#0 /var/www/vhosts/c3-dev/vendor/twig/twig/src/Extension/CoreExtension.php(1511): craft\web\twig\variables\Cp->field()
#1 /var/www/vhosts/c3-dev/vendor/craftcms/cms/src/helpers/Template.php(106): twig_get_attribute()
#2 /var/www/vhosts/c3-dev/storage/runtime/compiled_templates/7c/7c7ff6eebd29df9dc839aa4ff4087a340826151fefe4e6d114036c372d2b888f.php(893): craft\helpers\Template::attribute()
#3 /var/www/vhosts/c3-dev/vendor/twig/twig/src/Extension/CoreExtension.php(1114): __TwigTemplate_81b79d6a1632bcfa77dcb21eb22b69ad8f5ad8ea4053dd92ac1b1fb732177c82->macro_field()
#4 /var/www/vhosts/c3-dev/storage/runtime/compiled_templates/4c/4c12c5739d1a3d122028df9f40692d68f9211bc7d4b8a991ea64b83ac974f0db.php(397): twig_call_macro()
#5 /var/www/vhosts/c3-dev/vendor/twig/twig/src/Template.php(182): __TwigTemplate_7811cddd7f6ce37f1084cc729b1ba699984f896888f70fedadd169a321e3c9fd->block_details()
#6 /var/www/vhosts/c3-dev/vendor/twig/twig/src/Template.php(254): Twig\Template->displayBlock()
#7 /var/www/vhosts/c3-dev/storage/runtime/compiled_templates/7d/7d6efe7ba0fb0ef84b5dd5dd78ea575577e3208810f3cff39ee7ebe9f1e5d14a.php(101): Twig\Template->renderBlock()
#8 /var/www/vhosts/c3-dev/vendor/twig/twig/src/Template.php(405): __TwigTemplate_f8ee135d3a0cb51c872f72b5bd4281a62bff35fedd8671a156d199c589bbf2b7->doDisplay()
#9 /var/www/vhosts/c3-dev/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#10 /var/www/vhosts/c3-dev/storage/runtime/compiled_templates/25/25667423c6ab1f3a69ea83d2cc94e9dbac79c38e23ddba70f6e58751f66f1855.php(273): Twig\Template->display()
#11 /var/www/vhosts/c3-dev/vendor/twig/twig/src/Template.php(405): __TwigTemplate_803105b0cd1bde764a893992548ab863214c400a2d3b21b5e03dde013a80aaed->doDisplay()
#12 /var/www/vhosts/c3-dev/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#13 /var/www/vhosts/c3-dev/storage/runtime/compiled_templates/4c/4c12c5739d1a3d122028df9f40692d68f9211bc7d4b8a991ea64b83ac974f0db.php(76): Twig\Template->display()
#14 /var/www/vhosts/c3-dev/vendor/twig/twig/src/Template.php(405): __TwigTemplate_7811cddd7f6ce37f1084cc729b1ba699984f896888f70fedadd169a321e3c9fd->doDisplay()
#15 /var/www/vhosts/c3-dev/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#16 /var/www/vhosts/c3-dev/vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#17 /var/www/vhosts/c3-dev/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render()
#18 /var/www/vhosts/c3-dev/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render()
#19 /var/www/vhosts/c3-dev/vendor/craftcms/cms/src/web/View.php(408): Twig\Environment->render()
#20 /var/www/vhosts/c3-dev/vendor/craftcms/cms/src/web/View.php(461): craft\web\View->renderTemplate()
#21 /var/www/vhosts/c3-dev/vendor/craftcms/cms/src/web/Controller.php(201): craft\web\View->renderPageTemplate()
#22 /var/www/vhosts/c3-dev/vendor/putyourlightson/craft-campaign/src/controllers/CampaignsController.php(182): craft\web\Controller->renderTemplate()
#23 [internal function]: putyourlightson\campaign\controllers\CampaignsController->actionEditCampaign()
#24 /var/www/vhosts/c3-dev/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#25 /var/www/vhosts/c3-dev/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams()
#26 /var/www/vhosts/c3-dev/vendor/yiisoft/yii2/base/Module.php(534): yii\base\Controller->runAction()
#27 /var/www/vhosts/c3-dev/vendor/craftcms/cms/src/web/Application.php(287): yii\base\Module->runAction()
#28 /var/www/vhosts/c3-dev/vendor/yiisoft/yii2/web/Application.php(104): craft\web\Application->runAction()
#29 /var/www/vhosts/c3-dev/vendor/craftcms/cms/src/web/Application.php(272): yii\web\Application->handleRequest()
#30 /var/www/vhosts/c3-dev/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application->handleRequest()
#31 /var/www/vhosts/c3-dev/web/index.php(21): yii\base\Application->run()
#32 {main}

To reproduce

Click any campaign in the control panel

(The campaign renders fine on the front end, e.g. https://imagescience.com.au/newsletter-archive/november-newsletter)

Versions

  • Plugin version: 1.22.1
  • Craft version: 3.7.24
@bossanova808 bossanova808 added the bug Something isn't working label Dec 6, 2021
@bencroker
Copy link
Collaborator

Yup, this bug was introduced by Craft and has already been fixed for the next release in craftcms/cms@85e3910.

@bossanova808
Copy link
Author

Indeed - although Brandon did comment that:

I’m not sure when the next Craft release is going to go out, so it’s probably a good idea to just fix this on Link It’s end.

...same might hold here too?

@bencroker
Copy link
Collaborator

bencroker commented Dec 7, 2021

I don't know where that comment is from, but Tuesday is usually the day that Craft updates are released. In the meantime, you can downgrade to Craft 3.7.23 to resolve this until the fix is released (or temporarily hard-code the fix in the plugin). I get that is not ideal, but I think that the onus to push out the bugfix is on Craft, rather than every plugin that this affects.

@bossanova808
Copy link
Author

Sorry, should have linked it - presseddigital/linkit#92 (comment)

I'm fine with dev-develop Craft for a little bit, assuming a release won't be too far away. All good, just for info...

@bencroker
Copy link
Collaborator

I ended up fixing this in 88c7394 and released in version 1.22.2, thanks for reporting it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants