$_GET-variables ignored.

Hello again.

Now I've run into a problem I've never seen before. If I go to http://localhost?test=test and in my ControllerBase::initialize()-method and run:

var_dump($_GET);

I get:

array(1) {
  'test' =>
  string(4) "test"
}

But if I go to: http://localhost/user/loginWithFacebookCode?test=test and run the same code, I get: ```text array(1) { '_url' => string(27) "/user/loginWithFacebookCode" } ```

It seems that the $_GET-variables can only be picked up on the start page... If a route is executed, they're no longer available.

I've searched everywhere; Apache, PHP, Phalcon, never seen this anywhere. Any ideas as of why my $_GET["test"] doesn't exist?

Additional info: * I use the ACL from the Phalcon "Invo" example project where I've tried placing the methods / controller in both public and user visibilities (and made sure to empty the persistant variable). * OS: OSX Mountain Lion * Server: Apache2 * Engine: PHP 5.4.11

Anyone know where to look?

Thanks!

// dimhoLt



14.9k

I found it; the standard Phalcon htaccess has the following rule:

RewriteRule (.*) index.php?_url=/$1 [NC,L]

Which naturally erases all additional $GETs from the request. I'll just parse them out of the $SERVER["REQUEST_URI"] instead. http://global3.memecdn.com/i-am-a-disgrace-to-the-clan%5o%51110942.jpg

Thanks for any views, and hope this helps someone else.

Regards, dim



2.9k

echo $this->request->getQuery('test');

Try.

RewriteRule (.*) index.php?_url=/$1 [NC,L,QSA]

if you need all request parameters as $_GET variables.



2.9k

RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L] this is me.