<p>The issue appears <a href="https://github.com/craftcms/cms/blob/develop/src/helpers/App.php#L370" rel="nofollow noreferrer">here</a></p>

<pre><code>$isConsoleRequest = Craft::$app-&gt;getRequest()-&gt;getIsConsoleRequest();
if (!$isConsoleRequest &amp;&amp; !Craft::$app-&gt;getUser()-&gt;enableSession) {
    return null;
}
</code></pre>

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

<p>I guess it's a bug or something</p>

CC BY-SA 4.0
2018-08-01T19:08:33.047Z
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
CC BY-SA 4.0
2018-08-01T18:21:02.903Z
2018-08-01T18:21:02.903Z
Robin Schambach
<p>I tried searching for an answer for my situation but I could not find one. I tried following the steps here <a href="https://docs.craftcms.com/v3/upgrade.html#preparing-for-the-upgrade" rel="nofollow noreferrer">https://docs.craftcms.com/v3/upgrade.html#preparing-for-the-upgrade</a> but whenever I get to the browser step to complete upgrade, I get this error:</p>

<blockquote>
  <p>!/usr/bin/env php
  Exception 'yii\base\UnknownPropertyException' with message 'Getting unknown property: craft\console\User::enableSession'</p>
  
  <p>in /Users/avalosju/craft/vendor/yiisoft/yii2/base/Component.php:154</p>
  
  <p>Stack trace:</p>
  
  <p>0 /Users/avalosju/craft/vendor/craftcms/cms/src/helpers/App.php(372): yii\base\Component->__get('enableSession')</p>
  
  <p>1 /Users/avalosju/craft/vendor/craftcms/cms/src/config/app.php(214): craft\helpers\App::logConfig()</p>
  
  <p>2 [internal function]: {closure}()</p>
  
  <p>3 /Users/avalosju/craft/vendor/yiisoft/yii2/di/Container.php(503): call_user_func_array(Object(Closure), Array)</p>
  
  <p>4 /Users/avalosju/craft/vendor/yiisoft/yii2/BaseYii.php(351): yii\di\Container->invoke(Object(Closure), Array)</p>
  
  <p>5 /Users/avalosju/craft/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))</p>
  
  <p>6 /Users/avalosju/craft/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator->get('log', true)</p>
  
  <p>7 /Users/avalosju/craft/vendor/craftcms/cms/src/console/Application.php(146): yii\base\Module->get('log', true)</p>
  
  <p>8 /Users/avalosju/craft/vendor/yiisoft/yii2/base/Application.php(508): craft\console\Application->get('log')</p>
  
  <p>9 /Users/avalosju/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(1133): yii\base\Application->getLog()</p>
  
  <p>10 /Users/avalosju/craft/vendor/craftcms/cms/src/console/Application.php(62): craft\console\Application->_preInit()</p>
  
  <p>11 /Users/avalosju/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\console\Application->init()</p>
  
  <p>12 /Users/avalosju/craft/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)</p>
  
  <p>13 /Users/avalosju/craft/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array)</p>
  
  <p>14 /Users/avalosju/craft/vendor/craftcms/cms/src/console/Application.php(53): yii\console\Application->__construct(Array)</p>
  
  <p>15 [internal function]: craft\console\Application->__construct(Array)</p>
  
  <p>16 /Users/avalosju/craft/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass->newInstanceArgs(Array)</p>
  
  <p>17 /Users/avalosju/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('craft\console\A...', Array, Array)</p>
  
  <p>18 /Users/avalosju/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('craft\console\A...', Array, Array)</p>
  
  <p>19 /Users/avalosju/craft/vendor/craftcms/cms/bootstrap/bootstrap.php(252): yii\BaseYii::createObject(Array)</p>
  
  <p>20 /Users/avalosju/craft/vendor/craftcms/cms/bootstrap/console.php(31): require('/Users/avalosju...')</p>
  
  <p>21 /Users/avalosju/craft/craft(21): require('/Users/avalosju...')</p>
  
  <p>22 /Users/avalosju/craft/web/index.php(19): require_once('/Users/avalosju...')</p>
  
  <p>23 {main}</p>
</blockquote>

CC BY-SA 4.0
2018-08-01T22:47:19.557Z
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
<upgrades>
Upgrading Craft 2 to Craft 3 Yii Issues
# Upgrading Craft 2 to Craft 3 Yii Issues

(Asked by: username_0 on 2018-08-01)

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}

**Tags:** upgrades
> **Comments:**
> **username_1**: 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...')`  

---

## 1 answers

### Answer by username_2 on 2018-08-01. Score: 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

> **Comments:**
> **username_0**: 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  

---

