gotzmann / comet

Modern PHP framework for building blazing fast REST APIs and microservices
MIT License
661 stars 52 forks source link

Several GuzzleHttp classes not imported into Request #12

Closed halfik closed 3 years ago

halfik commented 4 years ago

When we try to build request from globals:

Request::fromGlobals();

We are going to get few errors: /var/www/html/vendor/gotzmann/comet/src/Request.php:176 >> Class 'Comet\ServerRequest' not found

It seems this imports are missing:

use GuzzleHttp\Psr7\Uri; use GuzzleHttp\Stream\CachingStream; use GuzzleHttp\Stream\LazyOpenStream; use GuzzleHttp\Psr7\ServerRequest;

gotzmann commented 4 years ago

You should not import any params from globals!

Comet works as stay-in-memory process and there no any guranties that $GLOBALS array contains any HTTP request data or changes with each new request.

Please-please do not assume that globals in Comet are working the same way as in typical PHP app within standard web-server.

halfik commented 4 years ago

I do not use globals. I was checking something and found this issue. Also if you don't want people to use this method, why it is there in first place?

gotzmann commented 3 years ago

I've disaled fromGlobals() method for Comet\Request objects at all. Thanks for getting my attention to the problem!