apisearch-io / symfony-react-server

[Deprecated] Symfony Async Server built on top of ReactPHP
MIT License
45 stars 1 forks source link

Argument 1 passed to Symfony\Component\HttpKernel\AsyncHttpKernel::__construct() must be an instance of Symfony\Component\HttpKernel\AsyncEventDispatcher, string given #9

Closed Noramarth closed 4 years ago

Noramarth commented 4 years ago

Fresh Symfony install using:

composer create-project symfony/skeleton application 4.4.99

edited composer.json to look like this

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.4",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "symfony/console": "4.4.*",
        "symfony/dotenv": "4.4.*",
        "symfony/flex": "^1.3.1",
        "symfony/framework-bundle": "4.4.*",
        "symfony/yaml": "4.4.*",
        "apisearch-io/symfony-async-http-kernel": "*",
        "apisearch-io/symfony-react-server": "dev-master"
    },
    "require-dev": {
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "4.4.*"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

reconfigured App\Kernel with:

//use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\HttpKernel\AsyncHttpKernel as BaseKernel;

and when running:

php vendor/bin/server 0.0.0.0:8100 --non-blocking --static-folder=public --bootstrap=symfony4

the result is:

Fatal error: Uncaught TypeError: Argument 1 passed to Symfony\Component\HttpKernel\AsyncHttpKernel::__construct() must be an instance of Symfony\Component\HttpKernel\AsyncEventDispatcher, string given, called in ~/projects/project/application/vendor/apisearch-io/symfony-react-server/src/Adapter/Symfony4KernelAdapter.php on line 39 and defined in ~/projects/project/application/vendor/apisearch-io/symfony-async-http-kernel/AsyncHttpKernel.php:64
Stack trace:
#0 ~/projects/project/application/vendor/apisearch-io/symfony-react-server/src/Adapter/Symfony4KernelAdapter.php(39): Symfony\Component\HttpKernel\AsyncHttpKernel->__construct('prod', false)
#1 ~/projects/project/application/vendor/apisearch-io/symfony-react-server/src/Application.php(144): Apisearch\SymfonyReactServer\Adapter\Symfony4KernelAdapter::buildKernel('prod', false)
#2 ~/projects/project/application/vendor/apisearch-io/symfony-react-server/bin/server(106): Apisearch\SymfonyReactServer\Application in ~/projects/project/application/vendor/apisearch-io/symfony-async-http-kernel/AsyncHttpKernel.php on line 64

ENV:

Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:    18.04
Codename:   bionic

PHP details:

System => Linux aesir 4.15.0-70-generic #79-Ubuntu SMP Tue Nov 12 10:36:11 UTC 2019 x86_64
Build Date => Dec  5 2019 21:36:22
Configure Command =>  './configure'  '--disable-all' '--enable-static' '--enable-option-checking=fatal' '--enable-cli' '--enable-ctype' '--with-iconv' '--enable-json' '--with-pcre-jit' '--enable-session' '--enable-tokenizer' '--with-libxml' '--enable-opcache' '--enable-mysqlnd' '--with-sodium=shared' '--with-password-argon2' '--with-mhash' '--enable-mbstring' '--with-curl' '--with-libedit' '--with-zlib' '--with-tsrm-pthreads' '--with-openssl' '--enable-phar' '--enable-filter' '--build=x86_64-linux-gnu' '--with-config-file-path=/etc/php/7.4/' '--with-config-file-scan-dir=/etc/php/7.4/conf.d' '--enable-xml' '--enable-simplexml' '--enable-xmlreader' '--enable-xmlwriter' '--enable-dom' 'build_alias=x86_64-linux-gnu'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/php/7.4/
Loaded Configuration File => (none)
Scan this dir for additional .ini files => /etc/php/7.4/conf.d
Additional .ini files parsed => /etc/php/7.4/conf.d/10-opcache.ini,
/etc/php/7.4/conf.d/10-sodium.ini

PHP API => 20190902
PHP Extension => 20190902
Zend Extension => 320190902
Zend Extension Build => API320190902,NTS
PHP Extension Build => API20190902,NTS
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => enabled
Zend Memory Manager => enabled
Zend Multibyte Support => provided by mbstring
IPv6 Support => enabled
DTrace Support => disabled

Registered PHP Streams => https, ftps, compress.zlib, php, file, glob, data, http, ftp, phar
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2, tlsv1.3
Registered Stream Filters => zlib.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk

This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies

 _______________________________________________________________________

Configuration

Core

PHP Version => 7.4.0

PHP Modules:

[PHP Modules]
Core
ctype
curl
date
dom
filter
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
Phar
readline
Reflection
session
SimpleXML
sodium
SPL
standard
tokenizer
xml
xmlreader
xmlwriter
Zend OPcache
zlib

[Zend Modules]
Zend OPcache
Noramarth commented 4 years ago

Sorry for posting, this is not a bug at all, my mistake was replacing the kernel with

use Symfony\Component\HttpKernel\AsyncHttpKernel as BaseKernel;

when the line should have been:

//use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\HttpKernel\AsyncKernel as BaseKernel;

Even though i will close the issue I will leave this here in case others also need to RTFM :)

mmoreram commented 4 years ago

@Noramarth Hello!

I have to update this package, because everything has been moved to https://driftphp.io I hope you enjoy all this work :)

Thanks!

Noramarth commented 4 years ago

I'd be glad to help out, just point me in the right direction :D

mmoreram commented 4 years ago

@Noramarth you can join our small community in Gitter if you need some support :)

https://gitter.im/driftphp/community