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

Fix: Avoid UnknownPropertyException in validation error response #191

Conversation

marc-farre
Copy link
Contributor

Prevents the following error message and should allow getValidationErrorResponse() to return a proper response instead of throwing an error.

yii\base\UnknownPropertyException: Getting unknown property:
humhub\modules\cfiles\models\Folder::baseFile in
/var/www/protected/vendor/yiisoft/yii2/base/Component.php:154
Stack trace:
#0
/var/www/protected/vendor/yiisoft/yii2/db/BaseActiveRecord.php(296):
yii\base\Component->__get('baseFile')
#1
/var/www/protected/humhub/modules/content/components/ContentActiveRecord.php(210):
yii\db\BaseActiveRecord->__get('baseFile')
#2
/var/www/protected/modules/cfiles/actions/UploadZipAction.php(40):
humhub\modules\content\components\ContentActiveRecord->__get('baseFile')
#3
/var/www/protected/modules/cfiles/actions/UploadZipAction.php(32):
humhub\modules\cfiles\actions\UploadZipAction->getValidationErrorResponse(Object(humhub\modules\cfiles\models\Folder))
#4
/var/www/protected/humhub/modules/file/actions/UploadAction.php(72):
humhub\modules\cfiles\actions\UploadZipAction->handleFileUpload(Object(yii\web\UploadedFile),
false)
#5
/var/www/protected/modules/cfiles/actions/UploadAction.php(36):
humhub\modules\file\actions\UploadAction->run()
#6 [internal function]:
humhub\modules\cfiles\actions\UploadAction->run()
#7
/var/www/protected/vendor/yiisoft/yii2/base/Action.php(93):
call_user_func_array(Array, Array)
#8
/var/www/protected/vendor/yiisoft/yii2/base/Controller.php(178):
yii\base\Action->runWithParams(Array)
#9
/var/www/protected/vendor/yiisoft/yii2/base/Module.php(552):
yii\base\Controller->runAction('upload', Array)
#10
/var/www/protected/vendor/yiisoft/yii2/web/Application.php(103):
yii\base\Module->runAction('cfiles/zip/uplo...', Array)
#11
/var/www/protected/vendor/yiisoft/yii2/base/Application.php(384):
yii\web\Application->handleRequest(Object(humhub\components\Request))
#12
/var/www/index.php(27)

@marc-farre
Copy link
Contributor Author

@luke- PR not tested because I don't know how to reproduce the bug, but should work.

@luke- luke- merged commit 7742f2d into humhub:master Sep 4, 2023
1 check passed
@marc-farre marc-farre deleted the fix/avoid-unknownPropertyException-in-validation branch September 4, 2023 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants