You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have four campaign types defined in our project config. Setting up the site on a new environment errors out while Craft tries to apply the project config:
> applying existing project config ... Exception: Attempt to read property "name" on null (/var/www/html/vendor/putyourlightson/craft-campaign/src/services/CampaignTypesService.php:263)
#0 /var/www/html/vendor/putyourlightson/craft-campaign/src/services/CampaignTypesService.php(263): yii\base\ErrorHandler->handleError(2, 'Attempt to read...', '/var/www/html/v...', 263)
#1 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(1125): putyourlightson\campaign\services\CampaignTypesService->handleChangedCampaignType(Object(craft\events\ConfigEvent))
#2 [internal function]: craft\services\ProjectConfig->handleChangeEvent(Object(craft\events\ConfigEvent))
#3 /var/www/html/vendor/yiisoft/yii2/base/Component.php(633): call_user_func(Array, Object(craft\events\ConfigEvent))
#4 /var/www/html/vendor/craftcms/cms/src/models/ProjectConfigData.php(79): yii\base\Component->trigger('addItem', Object(craft\events\ConfigEvent))
#5 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(1115): craft\models\ProjectConfigData->commitChanges(NULL, Array, 'campaign.campai...')
#6 [internal function]: craft\services\ProjectConfig->handleChangeEvent(Object(craft\events\ConfigEvent))
#7 /var/www/html/vendor/yiisoft/yii2/base/Component.php(633): call_user_func(Array, Object(craft\events\ConfigEvent))
#8 /var/www/html/vendor/craftcms/cms/src/models/ProjectConfigData.php(79): yii\base\Component->trigger('addItem', Object(craft\events\ConfigEvent))
#9 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(1231): craft\models\ProjectConfigData->commitChanges(NULL, Array, 'campaign.campai...', true, NULL, true)
#10 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(1253): craft\services\ProjectConfig->craft\services\{closure}('campaign.campai...', true)
[...]
*** failed to install Craft: An error occurred while executing the "craft\migrations\Install migration: Attempt to read property "name" on null
This also seems to happen whenever the Campaign project config is initially applied on an existing Craft install (without Campaign being installed previously).
The error is thrown in CampaignTypesService. The resave job it's adding to the queue is accessing $campaignType, which is always null.
Adding a naive null check on line 252 seems to have helped, but I'm not familiar enough with the plugin's internals to judge whether this is a bad idea, we'd probably want to exit the function before we even reach this line (or rather not even trigger it in the first place):
if (!$isNew && !is_null($campaignType)) {
Versions
craftcms/cms 4.2.5.2
putyourlightson/craft-campaign 2.1.7
The text was updated successfully, but these errors were encountered:
Wow, it actually does, thanks so much for the quick resolution!
I made sure to switch back and forth between develop and 431d8c2 a couple of times (dropping all database tables after each switch and running craft setup again). develop errors out every time, 431d8c2 runs flawlessly.
They say computer science is hard but I guess sometimes a cache clear is all you need. 😅
We have four campaign types defined in our project config. Setting up the site on a new environment errors out while Craft tries to apply the project config:
This also seems to happen whenever the Campaign project config is initially applied on an existing Craft install (without Campaign being installed previously).
The error is thrown in CampaignTypesService. The resave job it's adding to the queue is accessing
$campaignType
, which is alwaysnull
.Adding a naive null check on line 252 seems to have helped, but I'm not familiar enough with the plugin's internals to judge whether this is a bad idea, we'd probably want to exit the function before we even reach this line (or rather not even trigger it in the first place):
Versions
The text was updated successfully, but these errors were encountered: