-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Request::createFromGlobals() doesn't work #59533
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
Comments
i've founded more useful solution here private static function createRequestFromFactory(?array $query = null, ....l) { |
Please provide more information on how to reproduce your issue. What is the setup you have that leads to the PHP superglobals not being set? |
i am making request from independent script. It's not service or controller
This happened because empty $_POST return NULL. and function createRequestFromFactory can receive only Array type |
In this case you shouldn’t use the |
I am following the instructions. use Symfony\Component\HttpFoundation\Request; what i do wrang? |
The article assumes that you are running the script in an HTTP context and not on the command-line. |
I made it in an HTTP context. Symfony\Component\HttpFoundation\Request::createRequestFromFactory(): Argument #1 ($query) must be of type array, null given, called in /var/www/dev.grizlicnc.com.ua/vendor/symfony/http-foundation/Request.php on line 305
Please check createRequestFromFactory arguments, and you will get it |
Please show the output of the following lines: print_r($_SERVER);
print_r($_GET);
print_r($_POST); |
Array |
additional i'll show var_dump($_GET)
null - because $_GET is empty |
Could it be that the |
I just checked but even if I set |
hmm. it is really strange confuse. but my several different servers return NULL for empty $_POST $_GET. They use php8.1-fpm with nginx PHP 8.1.7 (cli) (built: Jun 25 2022 08:17:26) (NTS) i changed in php.ini but it didn't help Then... i'v checked this response in index.php and get it's really interesting and i found something like that in one helper package:
so, the question is done thank you for you time. really i am appreciate you |
Great you found the cause. 👍 I am closing the issue then. |
Symfony version(s) affected
6.4.17
Description
php version: 8.1.7
$_GET is empty
$_POST is empty
How to reproduce
i have HTTP 500 Internal Server Error when try to get Request by Request::createFromGlobals()
Possible Solution
add additional type (array|null) of variables $query and $query and $cookies
like that:
private static function createRequestFromFactory(array|null $query = [], array|null $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null): stat
Additional Context
No response
The text was updated successfully, but these errors were encountered: