title: Yii2 $_GET and Yii::$app->request->get() not working
body: <p><strong>Background</strong></p>
  
  <p>I'm having an odd issue with a simple line of code that I don't understand. I have an Action on a Controller that i'm using for LinkedIn auth. The first time the user hits the controller it redirects to the LinkedIn site for authentication, once the user authenticates linked in redirects back to the same controller with the auth code in the url as a param. </p>
  
  <p><code>http://beta.consynki.com/authentication/network/linkedin?code=DQTdGfxIlbsU...</code> </p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>class AuthenticationController extends WebController {
  
      public function actionNetwork($network){
          $access_token = Yii::$app-&gt;request-&gt;get('code');
  
          $network_connection      = NetworkFactory::build($network);
          $client = $network_connection-&gt;getClient();
  
          if($access_token &amp;&amp; !is_null($access_token)){
  
              $headers = Yii::$app-&gt;response-&gt;headers;
              $headers-&gt;set('Pragma', 'no-cache');
              $headers-&gt;add('X-Access-Token', $access_token);
  
              return $this-&gt;render('success');
          }
  
          return $this-&gt;redirect($client-&gt;getLoginUrl(),302)-&gt;send();
      }
  }
  </code></pre>
  
  <p><strong>EDIT 1 - WebController</strong></p>
  
  <pre><code>/**
   * Class WebController
   *
   * Default controller for public web pages. This class pulls meta tags from a seporately stored file, and makes
   * them available to the view.
   *
   * @package www\components
   */
  class WebController extends Controller {
  
      public $meta = [];
  
      public function beforeAction($event) {
  
          $controller = $this-&gt;id;
          $action     = $this-&gt;action-&gt;id;
          $meta_file  = Yii::getAlias('@www') . '/meta/' . $controller . '/' . $action . '.php';
  
          if (file_exists($meta_file)) {
              $this-&gt;meta = include($meta_file);
              $this-&gt;setMetaTags($this-&gt;meta);
          }
  
          return parent::beforeAction($event);
      }
  
      /**
       * Set the meta tags for a page
       *
       * @param string $type
       * @param        $tag
       * @param        $value
       */
      public function registerMetaTag($type = 'name', $tag, $value) {
  
          if (!is_null($value)) {
              $this-&gt;view-&gt;registerMetaTag([
                  $type     =&gt; $tag,
                  'content' =&gt; $value
              ]);
          }
  
      }
  
      public function behaviors() {
          return [
  
              /**
               * The particular campaign used.
               *
               * Example social_share, stay_connected_add
               */
              'utm_campaign' =&gt; [
                  'class'        =&gt; 'common\behavior\TrackingBehavior',
                  'queryParam'   =&gt; 'utm_campaign',
                  'sessionParam' =&gt; 'utm_campaign',
              ],
  
              /*
               * The source of the referral, could be an add network, facebook, email or just a link on the Consynki site.
               *
               * example: google, facebook, citysearch, welcome_email
               */
              'utm_source'   =&gt; [
                  'class'        =&gt; 'common\behavior\TrackingBehavior',
                  'queryParam'   =&gt; 'utm_source',
                  'sessionParam' =&gt; 'utm_source',
              ],
          ];
      }
  
      protected function setMetaTags($meta) {
          foreach ($meta AS $key =&gt; $value) {
              if (is_array($value)) {
                  $this-&gt;view-&gt;registerMetaTag($value, $key);
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>Problem</strong></p>
  
  <p>When I try to get the <code>code</code> from the GET param <code>Yii::$app-&gt;request-&gt;get('code');</code> I get a NULL value. On further inspection of the $_GET array <code>var_dump($app-&gt;request-&gt;get()</code> or <code>var_dump($_GET);</code> I see the key for the <code>code</code> variable has a $ <code>"?code"</code> in front of it. This is very odd.</p>
  
  <p><code>array(3) { ["network"]=&gt; string(8) "linkedin" ["?code"]=&gt; string(115) "DQTdGfxIlbsU..." ["state"]=&gt; string(32) "12121..." }</code></p>
  
  <p><strong>Research Notes</strong></p>
  
  <p>It looks like Yii2 modify's the $_GET value as it passes the url routing. Not sure if this is the issue. Have updated to the latest version of yii and it didn't fix the problem.</p>
  
  <p><strong>Question</strong></p>
  
  <p>Why would this happen? How can I fix it so that I can get the <code>code</code> value?</p>