Skip to content

Bug: Superglobals does not fully support actions #9392

Open
@neznaika0

Description

@neznaika0

PHP Version

8.3

CodeIgniter4 Version

4.6

CodeIgniter4 Installation Method

Git

Which operating systems have you tested for this bug?

Linux

Which server did you use?

cli-server (PHP built-in webserver)

What happened?

At the moment, Superglobals looks like a stub. There are no necessary actions:

  1. There is no getting all the values as an array. For example, to replace it in the Router: $this->globals['server'] = $_SERVER;

    if ($host !== null) {
    $request = service('request');
    $_SERVER = $request->getServer();
    $_SERVER['HTTP_HOST'] = $host;
    $request->setGlobal('server', $_SERVER);
    }

  2. The server() method can return not only a string, but also string|int|float|array. Array for argv, float for REQUEST_TIME

    public function server(string $key): ?string

  3. Keys cannot be deleted as unset($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])

    unset($_ENV['CI_ENVIRONMENT'], $_SERVER['CI_ENVIRONMENT']);

  4. Something important is in the process..

To upgrade to Superglobals, you need to check the all code. Because in many places, $_SERVER is overwritten. I'll try to get started.

I could send a PR, but I need to understand what to do. Is the function that I described enough for this?

I'm really sorry, this is more of a feature request. But I have problems accessing the forum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions