1

I tried searching for an answer for my situation but I could not find one. I tried following the steps here https://docs.craftcms.com/v3/upgrade.html#preparing-for-the-upgrade but whenever I get to the browser step to complete upgrade, I get this error:

!/usr/bin/env php Exception 'yii\base\UnknownPropertyException' with message 'Getting unknown property: craft\console\User::enableSession'

in /Users/avalosju/craft/vendor/yiisoft/yii2/base/Component.php:154

Stack trace:

0 /Users/avalosju/craft/vendor/craftcms/cms/src/helpers/App.php(372): yii\base\Component->__get('enableSession')

1 /Users/avalosju/craft/vendor/craftcms/cms/src/config/app.php(214): craft\helpers\App::logConfig()

2 [internal function]: {closure}()

3 /Users/avalosju/craft/vendor/yiisoft/yii2/di/Container.php(503): call_user_func_array(Object(Closure), Array)

4 /Users/avalosju/craft/vendor/yiisoft/yii2/BaseYii.php(351): yii\di\Container->invoke(Object(Closure), Array)

5 /Users/avalosju/craft/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))

6 /Users/avalosju/craft/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator->get('log', true)

7 /Users/avalosju/craft/vendor/craftcms/cms/src/console/Application.php(146): yii\base\Module->get('log', true)

8 /Users/avalosju/craft/vendor/yiisoft/yii2/base/Application.php(508): craft\console\Application->get('log')

9 /Users/avalosju/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(1133): yii\base\Application->getLog()

10 /Users/avalosju/craft/vendor/craftcms/cms/src/console/Application.php(62): craft\console\Application->_preInit()

11 /Users/avalosju/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\console\Application->init()

12 /Users/avalosju/craft/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)

13 /Users/avalosju/craft/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array)

14 /Users/avalosju/craft/vendor/craftcms/cms/src/console/Application.php(53): yii\console\Application->__construct(Array)

15 [internal function]: craft\console\Application->__construct(Array)

16 /Users/avalosju/craft/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass->newInstanceArgs(Array)

17 /Users/avalosju/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('craft\console\A...', Array, Array)

18 /Users/avalosju/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('craft\console\A...', Array, Array)

19 /Users/avalosju/craft/vendor/craftcms/cms/bootstrap/bootstrap.php(252): yii\BaseYii::createObject(Array)

20 /Users/avalosju/craft/vendor/craftcms/cms/bootstrap/console.php(31): require('/Users/avalosju...')

21 /Users/avalosju/craft/craft(21): require('/Users/avalosju...')

22 /Users/avalosju/craft/web/index.php(19): require_once('/Users/avalosju...')

23 {main}

Robin Schambach
  • 19,713
  • 1
  • 19
  • 44
Julian
  • 11
  • 2
  • What's on line 19 of your web/index.php file? Looks like it's doing something to load the craft console executable at craft/craft. /Users/avalosju/craft/web/index.php(19): require_once('/Users/avalosju...') – Brad Bell Aug 01 '18 at 22:47

1 Answers1

2

The issue appears here

$isConsoleRequest = Craft::$app->getRequest()->getIsConsoleRequest();
if (!$isConsoleRequest && !Craft::$app->getUser()->enableSession) {
    return null;
}

For whatever reasons Craft::$app->getRequest()->getIsConsoleRequest(); does not return true -> !false becomes true -> it tries to grab the user which should be an instance of craft\web\User to have the property enableSession but since it is a console request you receive craft\console\User which has not such a property.

I guess it's a bug or something

Robin Schambach
  • 19,713
  • 1
  • 19
  • 44
  • I tried reinstalling and it worked, but then I changed my web-server path in MAMP to another folder, then changed back and it's happening again. I wonder if there's a way to prevent this from happening – Julian Aug 01 '18 at 19:08