peachpiecompiler / peachpie

PeachPie - the PHP compiler and runtime for .NET and .NET Core
https://www.peachpie.io
Apache License 2.0
2.33k stars 202 forks source link

$_SERVER $GET is null when the code is not in index.php by version 1.0.0-appv4770 #1004

Closed avriltank closed 2 years ago

avriltank commented 2 years ago

index.php code:

<?php
var_dump($_SERVER);//data is ok
require_once __DIR__.'/Request.php';
$theReqeust = new \chenfa\Request();

Request.php code:

<?php
namespace chenfa;
class Request{
    public function __construct()
    {
        var_dump($_SERVER);//null
        var_dump($_GET);//null
        var_dump($_REQUEST);//null
        var_dump($_COOKIE);//null
   }
}
jakubmisek commented 2 years ago

thanks! it didn't even pass the tests