1up-lab/OneupUploaderBundle

Deprecation for symfony 5.3

sebastianwos opened this issue · 2 comments

Question

Bundle Version
Symfony 5.3.10
oneup/uploader-bundle 3.1.3

Orphanage Storage implementation classes for all types (Filesystem, Flysystem, Gaufrette) are using SessionInterface as constructor dependency. Since symfony 5.3 these are deprecated. I've got this message on deprecations log:

Since symfony/framework-bundle 5.3: The "session" service and "SessionInterface" alias are deprecated, use "$requestStack->getSession()" instead. It is being referenced by the "oneup_uploader.orphanage.*" service.

It is set by the OneupUploaderExtension in this manner:

            if ($orphanage) {
                $orphanageName = sprintf('oneup_uploader.orphanage.%s', $key);
                // this mapping wants to use the orphanage, so create
                // a masked filesystem for the controller
                $this->container
                    ->register($orphanageName, '%oneup_uploader.orphanage.class%')
                    ->addArgument($storageService)
                    ->addArgument(new Reference('session'))
                    ->addArgument(new Reference('oneup_uploader.chunks_storage'))
                    ->addArgument($this->config['orphanage'])
                    ->addArgument($key)
                    ->setPublic(true)
                ;

                // switch storage of mapping to orphanage
                $storageService = new Reference($orphanageName);
            }
        }

using reference like new Reference('session') which is also depraceted

I don't know if it is a bug but i future versions of symfony it might stop working, starting from 5.4 which is going to be released in few days i think.

I'll update/fix it accordingly in the next major release (4.x). 👍

This is fixed by #426 in the new 4.0.0 release.