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 deleting volume with a folder #3799

Closed
TonyDeStefano opened this issue Feb 7, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@TonyDeStefano
Copy link
Contributor

commented Feb 7, 2019

Description

I deleted a volume that had a folder and got this error until I manually deleted the folder record from the database:

yii\base\ErrorException: Trying to get property 'uid' of non-object in /var/www/html/vendor/craftcms/cms/src/fields/Assets.php:805
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/web/ErrorHandler.php(76): yii\base\ErrorHandler->handleError(8, 'Trying to get p...', '/var/www/html/v...', 805)
#1 /var/www/html/vendor/craftcms/cms/src/fields/Assets.php(805): craft\web\ErrorHandler->handleError(8, 'Trying to get p...', '/var/www/html/v...', 805, Array)
#2 /var/www/html/vendor/craftcms/cms/src/fields/Assets.php(125): craft\fields\Assets->_folderSourceToVolumeSource('folder:08830f02...')
#3 /var/www/html/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\fields\Assets->init()
#4 /var/www/html/vendor/craftcms/cms/src/fields/BaseRelationField.php(173): yii\base\BaseObject->__construct(Array)
#5 /var/www/html/vendor/craftcms/cms/src/helpers/Component.php(80): craft\fields\BaseRelationField->__construct(Array)
#6 /var/www/html/vendor/craftcms/cms/src/services/Fields.php(548): craft\helpers\Component::createComponent(Array, 'craft\\base\\Fiel...')
#7 /var/www/html/vendor/craftcms/cms/src/services/Fields.php(573): craft\services\Fields->createField(Array)
#8 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1536): craft\services\Fields->getAllFields()
#9 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1073): craft\elements\db\ElementQuery->customFields()
#10 /var/www/html/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare(Object(craft\db\mysql\QueryBuilder))
#11 /var/www/html/vendor/yiisoft/yii2/db/Query.php(146): yii\db\QueryBuilder->build(Object(craft\elements\db\UserQuery))
#12 /var/www/html/vendor/yiisoft/yii2/db/Query.php(274): yii\db\Query->createCommand(Object(craft\db\Connection))
#13 /var/www/html/vendor/craftcms/cms/src/db/Query.php(177): yii\db\Query->one(NULL)
#14 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1215): craft\db\Query->one(NULL)
#15 /var/www/html/vendor/craftcms/cms/src/elements/User.php(367): craft\elements\db\ElementQuery->one()
#16 /var/www/html/vendor/yiisoft/yii2/web/User.php(690): craft\elements\User::findIdentity('42693')
#17 /var/www/html/vendor/craftcms/cms/src/web/User.php(488): yii\web\User->renewAuthStatus()
#18 /var/www/html/vendor/yiisoft/yii2/web/User.php(192): craft\web\User->renewAuthStatus()
#19 /var/www/html/vendor/yiisoft/yii2/web/User.php(360): yii\web\User->getIdentity()
#20 /var/www/html/vendor/craftcms/cms/src/web/User.php(193): yii\web\User->getIsGuest()
#21 /var/www/html/vendor/craftcms/cms/src/web/Application.php(259): craft\web\User->getIsGuest()
#22 /var/www/html/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#23 /var/www/html/web/index.php(21): yii\base\Application->run()
#24 {main}

Steps to reproduce

  1. Delete a volume that has a folder attached to it.
  2. Go to any page in the control panel.

Additional info

  • Craft version: 3.1.7
  • PHP version: 7.2.11
  • Database driver & version: MySql 5.5.5
  • Plugins & versions:
@andris-sevcenko

This comment has been minimized.

Copy link
Member

commented Feb 8, 2019

This is because volumes are soft-deleted, but folders are not and folders rely on cascade delete to be deleted.

The best course of action here is to implement soft-delete for folders as well.

@brandonkelly

This comment has been minimized.

Copy link
Member

commented Feb 8, 2019

Fixed for the next release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.