Skip to content

Add an argument to Runtime which is more in line with http-foundation Request #60250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chx opened this issue Apr 22, 2025 · 2 comments
Open
Labels

Comments

@chx
Copy link
Contributor

chx commented Apr 22, 2025

I was reading https://symfony.com/doc/current/components/runtime.html for the first time and I found it odd it mentions $kernel->handle(Request::createFromGlobals())->send() when it also has array $request With keys query, body, files and session

Maybe a httpfoundation_request argument which resolves to an array which can be passed with the splat operator directly to Request::create would be beneficial so the runner could contain $kernel->handle(Request::create(... $request)) instead, decoupling the runner from globals?

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Apr 22, 2025

This sentence in the doc is about hinting the reader about what is done internally.

@xabbuh xabbuh added the Runtime label Apr 22, 2025
@chx
Copy link
Contributor Author

chx commented Apr 22, 2025

Here's what I suggest:

<?php
                case 'request':
                    return [
                        'query' => $_GET,
                        'body' => $_POST,
                        'files' => $_FILES,
                        'session' => &$_SESSION,
                    ];
                case 'httpfoundation_request':
                  return [
                      'query' => $_GET,
                      'request' => $_POST,
                      'cookies' => $_COOKIES,
                      'files' => $_FILES,
                      'server' => $_SERVER,
                  ];
?>

@chx chx changed the title Add a Add an argument to Runtime which is more in line with http-foundation Request Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants