verbb / comments

A Craft CMS plugin for managing comments directly within the CMS.
Other
137 stars 35 forks source link

Argument 1 passed to craft\services\Structures::appendToRoot() must be of the type integer, null given, called in /var/www/html/craft/vendor/verbb/comments/src/elements/Comment.php on line 842 #174

Closed viooolDN closed 4 years ago

viooolDN commented 4 years ago

Description

Argument 1 passed to craft\services\Structures::appendToRoot() must be of the type integer, null given, called in /var/www/html/craft/vendor/verbb/comments/src/elements/Comment.php on line 842

Steps to reproduce

  1. open a page with a comment field
  2. place a comment
  3. click on send
  4. POST 500 error

Additional info

Admin Bar | 3.1.10 Asset Rev | 6.0.2 Bugsnag | 2.0.6 Comments | 1.3.8 Dumper | 2.0.0 Element API | 2.6.0 Imager | v2.4.0 Redactor | 2.6.0.1 Redirect plugin for Craft 3 | 1.0.23 schema | 1.0.3 XML Sitemap | 1.2.0

2020-03-31 11:37:53 [-][-][-][error][TypeError] TypeError: Argument 1 passed to craft\services\Structures::appendToRoot() must be of the type integer, null given, called in /var/www/html/craft/vendor/verbb/comments/src/elements/Comment.php on line 842 and defined in /var/www/html/craft/vendor/craftcms/cms/src/services/Structures.php:265

Stack trace:

0 /var/www/html/craft/vendor/verbb/comments/src/elements/Comment.php(842): craft\services\Structures->appendToRoot(NULL, Object(verbb\comments\elements\Comment))

1 /var/www/html/craft/vendor/craftcms/cms/src/services/Elements.php(2124): verbb\comments\elements\Comment->afterSave(true)

2 /var/www/html/craft/vendor/craftcms/cms/src/services/Elements.php(530): craft\services\Elements->_saveElementInternal(Object(verbb\comments\elements\Comment), true, false, true)

3 /var/www/html/craft/vendor/verbb/comments/src/controllers/CommentsController.php(122): craft\services\Elements->saveElement(Object(verbb\comments\elements\Comment), true, true)

4 [internal function]: verbb\comments\controllers\CommentsController->actionSave()

5 /var/www/html/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)

6 /var/www/html/craft/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)

7 /var/www/html/craft/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('save', Array)

8 /var/www/html/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save', Array)

9 /var/www/html/craft/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction('comments/commen...', Array)

10 /var/www/html/craft/vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application->runAction('comments/commen...', Array)

11 /var/www/html/craft/vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application->_processActionRequest(Object(craft\web\Request))

12 /var/www/html/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))

13 /var/www/html/craft/web/index.php(22): yii\base\Application->run()

14 {main}

2020-03-31 11:37:53 [-][-][-][info][application] $_GET = []

engram-design commented 4 years ago

It seems like the plugin has lost its Structure that is created once, and only once, when its first installed. Was this a recent site upgrade, or a recent install of the comments plugin?

Are you using useProjectConfigFile and if so, can you provide the settings for the comments plugin?

viooolDN commented 4 years ago

Thank you for your reply. The problem is resolved.

cookie10codes commented 4 years ago

@viooolDN how did you solve this? I have the same problem... I'm using project.yaml