sjelfull / craft-audit

Audit log for Craft 3
https://superbig.co
Other
20 stars 11 forks source link

Error when installing plugin #78

Closed xinnings closed 10 months ago

xinnings commented 11 months ago

When I try to install the plugin in CMS admin, I see this error

 2023-12-25T10:02:52+00:00 [ERROR] Typed property superbig\audit\models\Settings::$tempPath must not be accessed before initialization
2023-12-25 18:02:52 {"trace":["#0 /app/vendor/superbig/craft-audit/src/Audit.php(115): yii\\base\\Model->toArray()","#1 [internal function]: superbig\\audit\\Audit->superbig\\audit\\{closure}()","#2 /app/vendor/yiisoft/yii2/base/Event.php(312): call_user_func()","#3 /app/vendor/yiisoft/yii2/base/Component.php(642): yii\\base\\Event::trigger()","#4 /app/vendor/craftcms/cms/src/services/Plugins.php(563): yii\\base\\Component->trigger()","#5 /app/vendor/craftcms/cms/src/controllers/PluginsController.php(52): craft\\services\\Plugins->installPlugin()","#6 [internal function]: craft\\controllers\\PluginsController->actionInstallPlugin()","#7 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()","#8 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams()","#9 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction()","#10 /app/vendor/craftcms/cms/src/web/Application.php(305): yii\\base\\Module->runAction()","#11 /app/vendor/craftcms/cms/src/web/Application.php(606): craft\\web\\Application->runAction()","#12 /app/vendor/craftcms/cms/src/web/Application.php(284): craft\\web\\Application->_processActionRequest()","#13 /app/vendor/yiisoft/yii2/base/Application.php(384): craft\\web\\Application->handleRequest()","#14 /app/web/index.php(92): yii\\base\\Application->run()","#15 {main}"],"memory":12017608,"exception":"[object] (Error(code: 0): Typed property superbig\\audit\\models\\Settings::$tempPath must not be accessed before initialization at /app/vendor/yiisoft/yii2/base/ArrayableTrait.php:126)"}

Audit: 3.0.2 Craft Pro: 4.5.11.1

xinnings commented 11 months ago

I manually change the code from

public string $tempPath;

to

public ?string $tempPath = null;

and it works. but the UI doesn't look ok image

sjelfull commented 10 months ago

Thanks for reporting, the setup error is fixed and will be included in a upcoming release. Will log the UI issue as a separate one.