Skip to content
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

[6.x] Added missing class exists checks #31027

Merged
merged 1 commit into from Jan 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Illuminate/Routing/RoutingServiceProvider.php
Expand Up @@ -15,6 +15,7 @@
use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory;
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
use Zend\Diactoros\Response as ZendPsrResponse;
use Zend\Diactoros\ServerRequestFactory;

class RoutingServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -132,14 +133,14 @@ protected function registerRedirector()
protected function registerPsrRequest()
{
$this->app->bind(ServerRequestInterface::class, function ($app) {
if (class_exists(PsrHttpFactory::class)) {
if (class_exists(Psr17Factory::class) && class_exists(PsrHttpFactory::class)) {
$psr17Factory = new Psr17Factory;

return (new PsrHttpFactory($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory))
->createRequest($app->make('request'));
}

if (class_exists(DiactorosFactory::class)) {
if (class_exists(ServerRequestFactory::class) && class_exists(DiactorosFactory::class)) {
return (new DiactorosFactory)->createRequest($app->make('request'));
}

Expand Down