Closed antanova closed 8 years ago
Can you see if this https://github.com/auraphp/Aura.Web/issues/28#issuecomment-38952434 helps.
Thank you! There is a problem with that comment though - as written on the PHP docs
Note: Gotcha Because variable variables may not be used with PHP's Superglobal arrays within functions, the Superglobal arrays may not be passed into compact().
However after reading that thread and seeing what the problem is, if I assign $_SERVER
to a variable first, then $GLOBALS
seems to work, e.g.
$redundant = $_SERVER;
$webfactory = new WebFactory($GLOBALS);
$request = $webfactory->newRequest();
$path = $request->url->get(PHP_URL_PATH);
gives me my path instead of NULL
.
... or, indeed following the subsequent example on the docs works - I had not seen that for some reason.
Thanks again.
cool :) .
Enjoy.
I'm using scotch box Vagrant image. When calling
it returns
NULL
. But when I usethe correct path is returned.
So, I did a var_dump to see if I could see what was happening. Here it is:
It seems that example.com is coming from
Url::getHostPort()
, and that all the components of the request are empty.I'm instantiating the request like this
Hopefully it's not me missing something silly.