craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.27k stars 635 forks source link

[5.1.1]: Calling unknown method: craft\web\Response::getIsDraft() #15724

Closed hatyi closed 1 month ago

hatyi commented 1 month ago

What happened?

Description

I'm trying to save a variant in Craft and sometimes I'm facing this error, it shows up as a flash message in the bottom left corner and it prevents the variant from being saved. If the error happens I can't discard the unsaved changes either.

Steps to reproduce

  1. Difficult to say, try saving variants.
  2. If the error pops up, I can't even discard the changes.

Expected behavior

Variant is updated or the changes are discarded.

Actual behavior

Screenshot from 2024-09-12 10-45-59 Screenshot from 2024-09-12 10-46-27

Stack trace

2024-09-12 10:41:26 [web.ERROR] [yii\base\UnknownMethodException] yii\base\UnknownMethodException: Calling unknown method: craft\web\Response::getIsDraft() in /var/www/html/vendor/yiisoft/yii2/base/Component.php:300 Stack trace:

0 /var/www/html/vendor/craftcms/cms/src/controllers/ElementsController.php(1637): yii\base\Component->__call('getIsDraft', Array)

1 [internal function]: craft\controllers\ElementsController->actionApplyDraft()

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

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

4 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('apply-draft', Array)

5 /var/www/html/vendor/craftcms/cms/src/web/Application.php(349): yii\base\Module->runAction('elements/apply-...', Array)

6 /var/www/html/vendor/craftcms/cms/src/web/Application.php(650): craft\web\Application->runAction('elements/apply-...', Array)

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

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

9 /var/www/html/web/index.php(12): yii\base\Application->run()

10 {main} {"memory":4796984,"exception":"[object] (yii\base\UnknownMethodException(code: 0): Calling unknown method: craft\web\Response::getIsDraft() at /var/www/html/vendor/yiisoft/yii2/base/Component.php:300)"}

Craft CMS version

5.1.1

PHP version

PHP 8.2.22 (cli)

Operating system and version

Ubuntu 22.04 (running PHP FPM, Nginx, MySQL in Docker)

Database type and version

mysql:8.0.36

Image driver and version

No response

Installed plugins and versions

{
  "minimum-stability": "dev",
  "prefer-stable": true,
  "require": {
    "algolia/algoliasearch-client-php": "^3.4",
    "craftcms/ckeditor": "^4.0.4",
    "craftcms/cms": "5.1.1",
    "craftcms/commerce": "5.0.3",
    "mmikkel/incognito-field": "2.0.0",
    "nystudio107/craft-vite": "^5.0.0",
    "presseddigital/linkit": "5.0.0",
    "putyourlightson/craft-sendgrid": "3.0.0",
    "studioespresso/craft-scout": "5.0.1",
    "tecnickcom/tcpdf": "^6.7",
    "verbb/formie": "3.0.0-beta.13",
    "verbb/navigation": "3.0.0",
    "verbb/wishlist": "3.0.1",
    "vlucas/phpdotenv": "^5.4.0",
    "yiisoft/yii2-redis": "^2.0"
  },
  "require-dev": {
    "craftcms/generator": "^2.0.0",
    "yiisoft/yii2-shell": "^2.0.3"
  },
  "autoload": {
    "psr-4": {
      "lyskomponenter\\": "modules/lyskomponenter"
    }
  },
  "config": {
    "allow-plugins": {
      "craftcms/plugin-installer": true,
      "yiisoft/yii2-composer": true
    },
    "sort-packages": true,
    "optimize-autoloader": true,
    "platform": {
      "php": "8.2"
    }
  },
  "scripts": {
    "post-root-package-install": [
      "@php -r \"file_exists('.env') || copy('.env.example.dev', '.env');\""
    ]
  },
  "repositories": [
    {
      "type": "composer",
      "url": "https://composer.craftcms.com",
      "canonical": false
    }
  ]
}
hatyi commented 1 month ago

I saw that even though I have started the development of this project only a few months ago I'm already way behind the current stable version.. So I'll try to update everything in the upcoming days and close / follow-up on the issue if it disappears.

i-just commented 1 month ago

Hi, I believe this was fixed in version 5.1.9 (via #15134).

I’ll close this now, but feel free to reach out again if the issue persists after the update.