Vichuploaderbundle: Bad dispatch in UploadHandler

Created on 10 Jul 2019  路  5Comments  路  Source: dustin10/VichUploaderBundle

Bug Report

Since the last tag, the upload on several of our projects are broken due to a mistake in the call of the Symfony dispatcher.

| Q | A
|------------ | ------
| BC Break | no
| Version | 1.10.0

Summary

When trying to upload some file on a Symfony 3.4 project, this error message appears :

Type error: Argument 2 passed to Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher::dispatch() must be an instance of Symfony\Component\EventDispatcher\Event or null, string given, called in /home/wwwroot/scp/vendor/vich/uploader-bundle/Handler/UploadHandler.php on line 110

The fact is that the recently added test to manage both versions of Symfony dispatch is ok, but the dispatch themselves are inverted in the if/else.

For instance on my project in Symfony 3.4, the code go on line https://github.com/dustin10/VichUploaderBundle/blob/1.10.0/Handler/UploadHandler.php#L110 which generate the bug as the call should be

$this->dispatcher->dispatch($eventName, $event);

Best regards

Bug

All 5 comments

Do you have Symfony contracts in vendors?

Yes in version 1.1.5

Please try to require dev-fix-dispatcher and see if it works

Thank you for your quick answer.

The bundle looks operationnal again with these corrections.

Do you plan to tag it soon ?

Immediately

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NicolaPez picture NicolaPez  路  6Comments

Chrysweel picture Chrysweel  路  4Comments

petrjirasek picture petrjirasek  路  7Comments

WassabiVl picture WassabiVl  路  3Comments

manguecreative picture manguecreative  路  4Comments