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 · 2 comments
Closed

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

croxton opened this issue Mar 20, 2024 · 2 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!

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

3 participants