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

[4.8.4]: Calling unknown method: craft\web\Response::getIsRevision() #14635

Closed
croxton opened this issue Mar 20, 2024 · 8 comments
Closed

[4.8.4]: Calling unknown method: craft\web\Response::getIsRevision() #14635

croxton opened this issue Mar 20, 2024 · 8 comments
Assignees

Comments

@croxton
Copy link

croxton commented Mar 20, 2024

What happened?

Description

Error thrown when saving an entry and returning to the entry listing screen (I think).

Steps to reproduce

I didn't notice any errors reported in the control panel, but happened to spot the error in the log a few seconds after editing an entry.

2024-03-20 12:09:14 [web.ERROR] [yii\base\UnknownMethodException] Calling unknown method: craft\web\Response::getIsRevision()
#0 [/var/www/html/vendor/craftcms/cms/src/controllers/ElementsController.php(1790):](https://github.com/craftcms/cms/tree/4.8.4/src/controllers/ElementsController.php#L1790) yii\base\Component->__call('getIsRevision', Array)
#1 [internal function]: craft\controllers\ElementsController->actionRecentActivity()
#2 [/var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57):](https://github.com/yiisoft/yii2/tree/2.0.48.1/framework/base/InlineAction.php#L57) call_user_func_array(Array, Array)
#3 [/var/www/html/vendor/yiisoft/yii2/base/Controller.php(178):](https://github.com/yiisoft/yii2/tree/2.0.48.1/framework/base/Controller.php#L178) yii\base\InlineAction->runWithParams(Array)
#4 [/var/www/html/vendor/yiisoft/yii2/base/Module.php(552):](https://github.com/yiisoft/yii2/tree/2.0.48.1/framework/base/Module.php#L552) yii\base\Controller->runAction('recent-activity', Array)
#5 [/var/www/html/vendor/craftcms/cms/src/web/Application.php(341):](https://github.com/craftcms/cms/tree/4.8.4/src/web/Application.php#L341) yii\base\Module->runAction('elements/recent...', Array)
#6 [/var/www/html/vendor/craftcms/cms/src/web/Application.php(642):](https://github.com/craftcms/cms/tree/4.8.4/src/web/Application.php#L642) craft\web\Application->runAction('elements/recent...', Array)
#7 [/var/www/html/vendor/craftcms/cms/src/web/Application.php(303):](https://github.com/craftcms/cms/tree/4.8.4/src/web/Application.php#L303) craft\web\Application->_processActionRequest(Object(craft\web\Request))
#8 [/var/www/html/vendor/yiisoft/yii2/base/Application.php(384):](https://github.com/yiisoft/yii2/tree/2.0.48.1/framework/base/Application.php#L384) craft\web\Application->handleRequest(Object(craft\web\Request))
#9 /var/www/html/web/index.php(12): yii\base\Application->run()
#10 {main}

The bug is happening here:

if (!$element || $element->getIsRevision()) {

Response from here:

return $this->redirect($element->getCpEditUrl());

So it's missing a check in the controller to see if the response from _element() is a web responses, and if it is, return it directly. (This is according to mattgrayisok)

Craft CMS version

4.8.4

PHP version

8.1

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

No response

@i-just
Copy link
Contributor

i-just commented Mar 21, 2024

Hi, thanks for reporting! I was able to replicate this (though not consistently). I raised a PR for this.

For future reference, to replicate this (not consistently), I did the following:

  • you need to have at least 2 sites (siteA, siteB)
  • at least 2 users with access to the control panel (user1, user2)
  • section enabled for both sites with at least one entry
  • log in as user1 in one browser, as user2 in another one (or private window)
  • in the first browser, logged in as user1, go to the entries index page for siteA
  • in the second browser, logged in as user2, edit the entry for siteB; make a change and click Save (not save and continue editing)
  • immediately go to the first browser and click the entry you just saved to open up the edit page
  • wait a few moments and see that in the ElementsController->actionRecentActivity(), the $element is a Response

@brandonkelly
Copy link
Member

Just released Craft 4.8.5 and 5.0.0-beta.11 with the fix for this. Thanks again!

@charliegrinsted
Copy link

hey @brandonkelly

We're seeing a similar thing when the elements/save-draft action is run, presumably when it tries to autosave? The site is running 4.10.5.

I'm not entirely sure how to reproduce it but I imagine it's similar to the convoluted aforementioned steps, as this is a multi site install with many editors.

2024-07-30 15:58:39 [web.ERROR] [yii\\base\\UnknownMethodException] Calling unknown method: craft\\web\\Response::getIsRevision()",
"#0 /var/www/html/vendor/craftcms/cms/src/controllers/ElementsController.php(1342): yii\\base\\Component->__call('getIsRevision', Array)",
"#1 [internal function]: craft\\controllers\\ElementsController->actionSaveDraft()",
"#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('save-draft', Array)",
"#5 /var/www/html/vendor/craftcms/cms/src/web/Application.php(340): yii\\base\\Module->runAction('elements/save-d...', Array)",
"#6 /var/www/html/vendor/craftcms/cms/src/web/Application.php(641): craft\\web\\Application->runAction('elements/save-d...', Array)",
"#7 /var/www/html/vendor/craftcms/cms/src/web/Application.php(302): 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/public/index.php(12): yii\\base\\Application->run()",
"#10 {main}"

brandonkelly added a commit that referenced this issue Aug 1, 2024
@brandonkelly
Copy link
Member

@charliegrinsted That should be fixed now for the next release.

To get the fix early, change your craftcms/cms requirement in composer.json to:

"craftcms/cms": "4.x-dev as 4.10.7",

and then run composer update.

@brandonkelly
Copy link
Member

Craft 4.10.8 is out with that fix. Thanks for reporting, @charliegrinsted!

@jonleverrier
Copy link

jonleverrier commented Sep 13, 2024

@brandonkelly @i-just I've started to see regular occurrences of this error message since updating Craft recently. Here's the stack trace (apologies for the formatting):

Calling unknown method: craft\web\Response::getIsRevision() {"trace":["#0 /home/removed/releases/0bec64af89ec999cee1d453404970c8c80c15d47/craft/vendor/craftcms/cms/src/controllers/ElementsController.php(1675): yii\\base\\Component->__call()","#1 [internal function]: craft\\controllers\\ElementsController->actionUpdateFieldLayout()","#2 /home/removed/releases/0bec64af89ec999cee1d453404970c8c80c15d47/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()","#3 /home/removed/releases/0bec64af89ec999cee1d453404970c8c80c15d47/craft/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams()","#4 /home/removed/releases/0bec64af89ec999cee1d453404970c8c80c15d47/craft/vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction()","#5 /home/removed/releases/0bec64af89ec999cee1d453404970c8c80c15d47/craft/vendor/craftcms/cms/src/web/Application.php(340): yii\\base\\Module->runAction()","#6 /home/removed/releases/0bec64af89ec999cee1d453404970c8c80c15d47/craft/vendor/craftcms/cms/src/web/Application.php(639): craft\\web\\Application->runAction()","#7 /home/removed/releases/0bec64af89ec999cee1d453404970c8c80c15d47/craft/vendor/craftcms/cms/src/web/Application.php(302): craft\\web\\Application->_processActionRequest()","#8 /home/removed/releases/0bec64af89ec999cee1d453404970c8c80c15d47/craft/vendor/yiisoft/yii2/base/Application.php(384): craft\\web\\Application->handleRequest()","#9 /home/removed/releases/0bec64af89ec999cee1d453404970c8c80c15d47/public/index.php(12): yii\\base\\Application->run()","#10 {main}"],"memory":5153328,"exception":"[object] (yii\\base\\UnknownMethodException(code: 0): Calling unknown method: craft\\web\\Response::getIsRevision() at /home/removed/releases/0bec64af89ec999cee1d453404970c8c80c15d47/craft/vendor/yiisoft/yii2/base/Component.php:308)"} 

I'm running 4.12.2. Should I open a new ticket?

@i-just
Copy link
Contributor

i-just commented Sep 13, 2024

@jonleverrier - thanks for the stack trace. I raised a PR for this.

@brandonkelly
Copy link
Member

@jonleverrier Craft 4.12.3 and 5.4.4 are out with that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants