humhub / rest

HumHub Rest API Module
24 stars 24 forks source link

Delete Space error: Attempt to read property \"id\" on null" #132

Closed Artillio closed 3 months ago

Artillio commented 1 year ago

What steps will reproduce the problem?

Good morning everyone. I'm having a problem with a Humhub space, I would like to delete it but when I do it from the admin panel I get an error page, so I tried deleting the space via API -> "api/v1/space/9" and I returns the following message: { "name": "PHP Warning", "message": "Attempt to read property \"id\" on null", "code": 2, "type": "yii\\base\\ErrorException", "file": "url/protected/humhub/modules/content/components/ContentContainerSettingsManager.php", "line": 80, "stack-trace": [ "#0 url/protected/humhub/modules/content/components/ContentContainerSettingsManager.php(80): yii\\base\\ErrorHandler->handleError(2, 'Attempt to read...', '/home2/cvivaioq...', 80)", "#1 url/protected/humhub/libs/BaseSettingsManager.php(185): humhub\\modules\\content\\components\\ContentContainerSettingsManager->find()", "#2 url/protected/humhub/libs/BaseSettingsManager.php(53): humhub\\libs\\BaseSettingsManager->loadValues()", "#3 url/protected/vendor/yiisoft/yii2/base/BaseObject.php(109): humhub\\libs\\BaseSettingsManager->init()", "#4 url/protected/humhub/components/SettingsManager.php(42): yii\\base\\BaseObject->__construct(Array)", "#5 url/protected/humhub/modules/content/components/ContentContainerModule.php(154): humhub\\components\\SettingsManager->contentContainer(Object(humhub\\modules\\space\\models\\Space))", "#6 url/protected/modules/polls/Module.php(70): humhub\\modules\\content\\components\\ContentContainerModule->disableContentContainer(Object(humhub\\modules\\space\\models\\Space))", "#7 url/protected/humhub/modules/content/components/ContentContainerModuleManager.php(50): humhub\\modules\\polls\\Module->disableContentContainer(Object(humhub\\modules\\space\\models\\Space))", "#8 url/protected/humhub/modules/space/models/Space.php(308): humhub\\modules\\content\\components\\ContentContainerModuleManager->disable('polls')", "#9 url/protected/vendor/yiisoft/yii2/db/ActiveRecord.php(754): humhub\\modules\\space\\models\\Space->beforeDelete()", "#10 url/protected/vendor/yiisoft/yii2/db/ActiveRecord.php(724): yii\\db\\ActiveRecord->deleteInternal()", "#11 url/protected/modules/rest/controllers/space/SpaceController.php(133): yii\\db\\ActiveRecord->delete()", "#12 [internal function]: humhub\\modules\\rest\\controllers\\space\\SpaceController->actionDelete('9')", "#13 url/protected/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)", "#14 url/protected/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams(Array)", "#15 url/protected/vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction('delete', Array)", "#16 url/protected/vendor/yiisoft/yii2/web/Application.php(103): yii\\base\\Module->runAction('rest/space/spac...', Array)", "#17 url/protected/vendor/yiisoft/yii2/base/Application.php(384): yii\\web\\Application->handleRequest(Object(humhub\\components\\Request))", "#18 url/index.php(25): yii\\base\\Application->run()", "#19 {main}" ] }

What is the expected result?

Delete the space

What do you get instead?

Error

Additional info

Q A
HumHub version 1.14.2
PHP version 8.2.7
Operating system Shared Host

Note: Also provide the full error stacks from Administration --> Information --> Logging and errors from your browser console if possible. Note: Please use the community site for any questions on customizing HumHub.

luke- commented 1 year ago

@gevorgmansuryan Can you please give feedback here: https://github.com/humhub/humhub/pull/6534#issuecomment-1705299387

gevorgmansuryan commented 1 year ago

@luke- sorry. Tagged wrong issue. Updated description of https://github.com/humhub/humhub/pull/6534

luke- commented 1 year ago

@gevorgmansuryan Thanks for the update.

Regarding this issue: Is the Core PR really necessary? Is there no chance to fix this in the REST module only?

gevorgmansuryan commented 1 year ago

@luke- regarding to description the error occurs on core too I would like to delete it but when I do it from the admin panel I get an error page

luke- commented 3 months ago

@gevorgmansuryan Can this be closed?

gevorgmansuryan commented 3 months ago

@luke- PR was closed and not merged https://github.com/humhub/humhub/pull/6491. If we don't need this anymore we can close this too.