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

[5.x]: Error when pruning orphaned entries in 5.6.3 #16598

Closed
elivz opened this issue Jan 30, 2025 · 1 comment
Closed

[5.x]: Error when pruning orphaned entries in 5.6.3 #16598

elivz opened this issue Jan 30, 2025 · 1 comment
Labels

Comments

@elivz
Copy link

elivz commented Jan 30, 2025

What happened?

Description

You added a getOwnerType method to NestedElementTrait in 5.6.3. Now when I run utils/prune-orphaned-entries the command immediately errors out, because an orphaned entry by definition does not have an owner, at that code is attempting to assign null to a string-typed $ownerType property.

Stack Trace

Finding orphaned entries for site "US - English" ... 517 found
 → Deleting entry 8683653 in US - English … error: Cannot assign null to property craft\elements\Entry::$ownerType of type string
Exception 'TypeError' with message 'Cannot assign null to property craft\elements\Entry::$ownerType of type string'

in /var/www/vendor/craftcms/cms/src/base/NestedElementTrait.php:381

Stack trace:
#0 /var/www/vendor/craftcms/cms/src/base/NestedElementTrait.php(41): craft\elements\Entry->ownerType()
#1 /var/www/vendor/craftcms/cms/src/elements/Entry.php(732): craft\elements\Entry::traitEagerLoadingMap()
#2 /var/www/vendor/craftcms/cms/src/services/Elements.php(3218): craft\elements\Entry::eagerLoadingMap()
#3 /var/www/vendor/craftcms/cms/src/services/Elements.php(3180): craft\services\Elements->_eagerLoadElementsInternal()
#4 /var/www/vendor/craftcms/cms/src/base/NestedElementTrait.php(173): craft\services\Elements->eagerLoadElements()
#5 /var/www/vendor/craftcms/cms/src/base/NestedElementTrait.php(239): craft\elements\Entry->getPrimaryOwner()
#6 /var/www/vendor/craftcms/cms/src/helpers/ElementHelper.php(553): craft\elements\Entry->getOwner()
#7 /var/www/vendor/putyourlightson/craft-blitz/src/services/RefreshCacheService.php(279): craft\helpers\ElementHelper::isDraftOrRevision()
#8 /var/www/vendor/putyourlightson/craft-blitz/src/Blitz.php(387): putyourlightson\blitz\services\RefreshCacheService->isRefreshableElement()
#9 [internal function]: putyourlightson\blitz\Blitz->putyourlightson\blitz\{closure}()
#10 /var/www/vendor/yiisoft/yii2/base/Event.php(312): call_user_func()
#11 /var/www/vendor/yiisoft/yii2/base/Component.php(650): yii\base\Event::trigger()
#12 /var/www/vendor/craftcms/cms/src/services/Elements.php(2345): yii\base\Component->trigger()
#13 /var/www/vendor/craftcms/cms/src/services/Elements.php(2527): craft\services\Elements->deleteElement()
#14 /var/www/vendor/craftcms/cms/src/services/Elements.php(2430): craft\services\Elements->deleteElementsForSite()
#15 /var/www/vendor/craftcms/cms/src/console/controllers/utils/PruneOrphanedEntriesController.php(72): craft\services\Elements->deleteElementForSite()
#16 /var/www/vendor/craftcms/cms/src/console/Controller.php(493): craft\console\controllers\utils\PruneOrphanedEntriesController->craft\console\controllers\utils\{closure}()
#17 /var/www/vendor/craftcms/cms/src/console/controllers/utils/PruneOrphanedEntriesController.php(71): craft\console\Controller->do()
#18 [internal function]: craft\console\controllers\utils\PruneOrphanedEntriesController->actionIndex()
#19 /var/www/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#20 /var/www/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#21 /var/www/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction()
#22 /var/www/vendor/craftcms/cms/src/console/ControllerTrait.php(88): yii\console\Controller->runAction()
#23 /var/www/vendor/craftcms/cms/src/console/Controller.php(216): craft\console\Controller->traitRunAction()
#24 /var/www/vendor/yiisoft/yii2/base/Module.php(552): craft\console\Controller->runAction()
#25 /var/www/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction()
#26 /var/www/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction()
#27 /var/www/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction()
#28 /var/www/vendor/craftcms/cms/src/console/Application.php(122): yii\console\Application->handleRequest()
#29 /var/www/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest()
#30 /var/www/craft(13): yii\base\Application->run()
#31 {main}

Craft CMS version

5.6 3

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@brandonkelly
Copy link
Member

Thanks for reporting that! Craft 5.6.4 is out with a fix.

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

No branches or pull requests

2 participants