contributte / event-dispatcher-extra

:recycle: Nette-based Symfony events for application, presenter, form, latte, templates, security and many others.
https://contributte.org/packages/contributte/event-dispatcher-extra.html
MIT License
7 stars 5 forks source link

Too few arguments to function PresenterStartupEvent::__construct() #15

Closed josefsabl closed 6 years ago

josefsabl commented 6 years ago

I am not sure if this is the better place to report this problem I am having with arachne/entity-loader.

I am getting such error: Too few arguments to function Contributte\Events\Extra\Event\Application\PresenterStartupEvent::__construct(), 0 passed in ...temp\cache\Nette.Configurator\Container_689ab32e47.php on line 733 and exactly 1 expected.

josefsabl commented 6 years ago

The version from this pull request works for me. To install add this to composer.json

    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/josefsabl/event-dispatcher-extra.git"
        }
    ],
    "require": {
        "contributte/event-dispatcher-extra": "dev-fix-too-few-args#625c807df28e3e2951c04aa543679b06152ec668 as 0.4.0"
    }
f3l1x commented 6 years ago

According to tests added at #17, it's working. What PHP version do you use?

josefsabl commented 6 years ago

I am on 7.2.4. But I think that the fix should work for older versions as well.

josefsabl commented 6 years ago

Ok, I got it. The problem actually appears when combined with Arachne Security Verifier.

See this piece of code in Arachne.

It was discussed here and closed as problem with Contributte.

mabar commented 6 years ago

Well, I see now. onStartup is called here https://github.com/nette/application/blob/master/src/Application/UI/Presenter.php#L182 Startup method in Arachne is redundant and called without required presenter instance. Could you remove it please? https://github.com/Arachne/Verifier/blob/1aad7cd228439cf84ee1f7cf35fd7ad578b9bc50/src/Application/VerifierPresenterTrait.php#L81-L86

josefsabl commented 6 years ago

Yeah, I can confirm that onStartup is called twice. Which is probably not good thing anyway. @enumag

enumag commented 6 years ago

@josefsabl Wait, twice? How? Are you using nette/application 3.0?

mabar commented 6 years ago

@enumag It is already in 2.4 https://github.com/nette/application/releases/tag/v2.4.11

enumag commented 6 years ago

@mabar Oh ok. In that case deleting the call in arachne and increasing required nette version should fix it.