title: Yii2 Setting unknown property: yii\filters\auth\HttpBearerAuth::formats
body: <p>I am creating apis in <code>YII2</code> each and every request is working well but in <code>PUT</code> request I am getting below error</p>
  
  <blockquote>
    <p>Unknown Property – yii\base\UnknownPropertyException</p>
    
    <p>Setting unknown property: yii\filters\auth\HttpBearerAuth::formats</p>
  </blockquote>
  
  <p>This is my stack trace</p>
  
  <blockquote>
    <ol>
    <li><p>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\base\Object.php at line 161 152153154155156157158159160161162163164165166167168169170<br>
    */
    public function __set($name, $value)
    {
        $setter = 'set' . $name;
        if (method_exists($this, $setter)) {
            $this->$setter($value);
        } elseif (method_exists($this, 'get' . $name)) {
            throw new InvalidCallException('Setting read-only property: ' . get_class($this) . '::' . $name);
        } else {
            throw new UnknownPropertyException('Setting unknown property: ' . get_class($this) . '::' . $name);
        }
    }</p>
    
    <p>/**</p>
    
    <ul>
    <li>Checks if a property is set, i.e. defined and not null.
    *</li>
    <li>Do not call this method directly as it is a PHP magic method that</li>
    <li>will be implicitly called when executing <code>isset($object-&gt;property)</code>.
    *</li>
    </ul></li>
    <li>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\BaseYii.php at line 525 – yii\base\Object::__set('formats', ['application/json' =>
    'json'])</li>
    <li>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\base\Object.php at line 105 – yii\BaseYii::configure(yii\filters\auth\HttpBearerAuth,
    ['only' => ['index', 'view', 'create', 'update', ...], 'formats' =>
    ['application/json' => 'json']])</li>
    <li>yii\base\Object::__construct(['only' => ['index', 'view', 'create', 'update', ...], 'formats' => ['application/json' => 'json']])</li>
    <li>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\di\Container.php at line 381 – ReflectionClass::newInstanceArgs([['only' => ['index',
    'view', 'create', 'update', ...], 'formats' => ['application/json' =>
    'json']]])</li>
    <li>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\di\Container.php at line 156 – yii\di\Container::build('yii\filters\auth\HttpBearerAuth',
    [], ['only' => ['index', 'view', 'create', 'update', ...], 'formats'
    => ['application/json' => 'json']])</li>
    <li>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\BaseYii.php at line 344 – yii\di\Container::get('yii\filters\auth\HttpBearerAuth', [],
    ['only' => ['index', 'view', 'create', 'update', ...], 'formats' =>
    ['application/json' => 'json']])</li>
    <li>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\base\Component.php at line 667 – yii\BaseYii::createObject(['class' =>
    'yii\filters\auth\HttpBearerAuth', 'only' => ['index', 'view',
    'create', 'update', ...], 'formats' => ['application/json' =>
    'json']])</li>
    <li>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\base\Component.php at line 651 – yii\base\Component::attachBehaviorInternal(0, ['class'
    => 'yii\filters\auth\HttpBearerAuth', 'only' => ['index', 'view', 'create', 'update', ...], 'formats' => ['application/json' =>
    'json']])</li>
    <li>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\base\Component.php at line 533 – yii\base\Component::ensureBehaviors()</li>
    <li>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\base\Controller.php at line 272 – yii\base\Component::trigger('beforeAction',
    yii\base\ActionEvent)</li>
    <li>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\web\Controller.php at line 164 – yii\base\Controller::beforeAction(yii\rest\UpdateAction)</li>
    <li>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\base\Controller.php at line 154 – yii\web\Controller::beforeAction(yii\rest\UpdateAction)</li>
    <li>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\base\Module.php at line 523 – yii\base\Controller::runAction('update', ['id' => '1'])</li>
    <li>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\web\Application.php at line 102 – yii\base\Module::runAction('products/update', ['id' =>
    '1'])</li>
    <li>in D:\xampp\htdocs\connect\vendor\yiisoft\yii2\base\Application.php at
    line 380 – yii\web\Application::handleRequest(yii\web\Request)</li>
    <li>in D:\xampp\htdocs\connect\index.php at line 12 – yii\base\Application::run() 6789101112  require(<strong>DIR</strong> .
    '/vendor/autoload.php'); require(<strong>DIR</strong> .
    '/vendor/yiisoft/yii2/Yii.php');   $config = require(<strong>DIR</strong> .
    '/config/web.php');   (new yii\web\Application($config))->run(); 
    $_GET = [
    'id' => '1', ]; Yii Framework 2017-02-23, 09:31:51</li>
    </ol>
    
    <p>Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/5.6.28 Yii Framework/2.0.11.2</p>
  </blockquote>
  
  <p>Behaviors in controller is</p>
  
  <pre><code>  public function behaviors() {
          return [
              [
                  'class' =&gt; HttpBearerAuth::className(),
                  'only' =&gt; ['index', 'view', 'create', 'update', 'search'],
                  'formats' =&gt; ['application/json' =&gt; Response::FORMAT_JSON,],
              ],
              'verbs' =&gt; [
                  'class' =&gt; VerbFilter::className(),
                  'actions' =&gt; [
                      'index' =&gt; ['get'],
                      'view' =&gt; ['get'],
                      'create' =&gt; ['post'],
                      'update' =&gt; ['PUT'],
                      'delete' =&gt; ['delete'],
                      'deleteall' =&gt; ['post'],
                      'search' =&gt; ['get']
                  ],
              ]
          ];
      }
  </code></pre>
  
  <p>I am testing it with <code>postman</code> and passing <code>Authorization</code> in each api.</p>
  
  <p>This is my header </p>
  
  <p><a href="https://i.stack.imgur.com/liTmY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/liTmY.png" alt="enter image description here"></a></p>
  
  <p>What could be the issue?</p>