[TYPO3-50-general] Strange behavior of $this->SERVER in Utility\Environment

Christoph Blömer chbloemer at gmx.net
Fri Jan 23 05:17:00 CET 2009


Christoph Blömer schrieb:
> Hello,
> I'm currently trying to extend the \F3\FLOW3\Utility\Environment class.
>
> This is what I'm doing. I need to add some more REQUEST_METHOD to the 
> Environment.
>
> So I basically did this:
>
> class Environment extends \F3\FLOW3\Utility\Environment {
>     public function getRequestMethod() {
>         echo("_".$this->SERVER['REQUEST_METHOD']."_");
>     }
> }
>
> After that I changed the Object.yaml of the package to:
>
> F3\FLOW3\MVC\Web\RequestHandler:
>   arguments:
>     2: { object: F3\WebDAV\Utility\Environment }
>
> This replaces the Environment with the new one in the package.
>
> The methods gets called and shows: __
> But it should show: _GET_
>
> I also added a echo to the getRequestMethod of the parent class to check 
> if its working their.
> It shows: _GET_ as expected.
>
> So why is it not possible to read the $this->SERVER variable in the 
> child class???
>
> Anybody a idea?
>
>   
I just found out that if I comment out the line:
$_SERVER = new \F3\FLOW3\Utility\SuperGlobalReplacement('_SERVER', 'Please use the ' . __CLASS__ . ' object instead of accessing the superglobal directly.');

The $this->SERVER variable is available in the child class of F3\FLOW3\Utility\Environment.
Is that a intended behavior?

Greetings
Christoph






More information about the TYPO3-project-5_0-general mailing list