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

Deprecation of single colon when referencing controllers in SF 4.1 #340

Closed
KDederichs opened this issue Jul 6, 2018 · 16 comments
Closed

Comments

@KDederichs
Copy link
Contributor

Starting at Symfony 4.1 you'll get a
Referencing controllers with a single colon is deprecated since Symfony 4.1. Use oneup_uploader.controller.xxxx::upload instead.
deprecation for generated routes.

@KDederichs
Copy link
Contributor Author

Ok judging from those nice failed tests, the double colon seems to be new in PHP 7.1, now I'm not sure if it's better to find a way to recognize the php version and then use that to determine if it's a double or single colon or if it would be better to bump the minimum php version to 7.1 (which seems to be required by SF 4.1)

@MHaendel
Copy link

Facing the same problem

@bytehead
Copy link
Member

Fixed in fc4750b.

@patryk-stawowczyk
Copy link

@bytehead What about SF 3.4? Using double colon throw exception "Class "oneup_uploader.controller.gallery" does not exist."

@bytehead
Copy link
Member

Can you show me your requirements in your composer.json?

@patryk-stawowczyk
Copy link

patryk-stawowczyk commented Jul 17, 2018

"php": ">=7.1",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"incenteev/composer-parameter-handler": "^2.0",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^5.0.0",
"symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/swiftmailer-bundle": "^2.6.4",
"symfony/symfony": "3.4.*",
"twig/twig": "^1.0||^2.0",
"oneup/uploader-bundle": "^2.0",

@bytehead
Copy link
Member

bytehead commented Jul 17, 2018

Strange, can't reproduce this with a Symfony 3.4.12. And the bundle is also tested against Symfony ^3.4

@bytehead
Copy link
Member

what does composer show output in your project?

@patryk-stawowczyk
Copy link

patryk-stawowczyk commented Jul 18, 2018

behat/transliterator                 v1.2.0  String transliterator
composer/ca-bundle                   1.1.1   Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.
deployer/deployer                    v6.2.0  Deployment Tool
deployer/phar-update                 v2.1.0  Integrates Phar Update to Symfony Console.
doctrine/annotations                 v1.6.0  Docblock Annotations Parser
doctrine/cache                       v1.7.1  Caching library offering an object-oriented API for many cache backends
doctrine/collections                 v1.5.0  Collections Abstraction library
doctrine/common                      v2.8.1  Common Library for Doctrine projects
doctrine/dbal                        v2.7.1  Database Abstraction Layer
doctrine/doctrine-bundle             1.9.1   Symfony DoctrineBundle
doctrine/doctrine-cache-bundle       1.3.3   Symfony Bundle for Doctrine Cache
doctrine/inflector                   v1.3.0  Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator                1.1.0   A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                       v1.0.1  Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm                         v2.6.1  Object-Relational-Mapper for PHP
fig/link-util                        1.0.0   Common utility implementations for HTTP links
fzaninotto/faker                     v1.7.1  Faker is a PHP library that generates fake data for you.
gedmo/doctrine-extensions            v2.4.35 Doctrine2 behavioral extensions
incenteev/composer-parameter-handler v2.1.3  Composer script handling your ignored parameter file
jdorn/sql-formatter                  v1.2.17 a PHP SQL highlighting library
jms/metadata                         1.6.0   Class/method/property metadata management in PHP
jms/parser-lib                       1.0.0   A library for easily creating recursive-descent parsers.
jms/serializer                       1.12.1  Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.
jms/serializer-bundle                2.4.2   Allows you to easily serialize, and deserialize data of any complexity
knplabs/knp-components               1.3.8   Knplabs component library
knplabs/knp-menu                     2.3.0   An object oriented menu library
knplabs/knp-menu-bundle              v2.2.1  This bundle provides an integration of the KnpMenu library
knplabs/knp-paginator-bundle         v2.8.0  Paginator bundle for Symfony to automate pagination and simplify sorting and other features
knplabs/knp-time-bundle              1.8.0   Knplabs time bundle makes your dates look sensible and descriptive
monolog/monolog                      1.23.0  Sends your logs to files, sockets, inboxes, databases and various web services
oneup/uploader-bundle                2.0.6   Handles multi file uploads in Symfony2. Features included: Chunked upload, Orphans management, Gaufrette support.
paragonie/random_compat              v2.0.15 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phpcollection/phpcollection          0.5.0   General-Purpose Collection Library for PHP
phpoffice/phpspreadsheet             1.3.1   PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
phpoption/phpoption                  1.5.0   Option Type for PHP
pimple/pimple                        v3.2.3  Pimple, a simple Dependency Injection Container
psr/cache                            1.0.1   Common interface for caching libraries
psr/container                        1.0.0   Common Container Interface (PHP FIG PSR-11)
psr/link                             1.0.0   Common interfaces for HTTP links
psr/log                              1.0.2   Common interface for logging libraries
psr/simple-cache                     1.0.1   Common interfaces for simple caching
sensio/distribution-bundle           v5.0.22 Base bundle for Symfony Distributions
sensio/framework-extra-bundle        v5.1.6  This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle              v3.1.7  This bundle generates code for you
sensiolabs/security-checker          v4.1.8  A security checker for your composer.lock
stof/doctrine-extensions-bundle      v1.3.0  Integration of the gedmo/doctrine-extensions with Symfony2
swiftmailer/swiftmailer              v5.4.9  Swiftmailer, free feature-rich PHP mailer
symfony/monolog-bundle               v3.3.0  Symfony MonologBundle
symfony/phpunit-bridge               v2.8.41 Symfony PHPUnit Bridge
symfony/polyfill-apcu                v1.8.0  Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-ctype               v1.8.0  Symfony polyfill for ctype functions
symfony/polyfill-intl-icu            v1.8.0  Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring            v1.8.0  Symfony polyfill for the Mbstring extension
symfony/polyfill-php56               v1.8.0  Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70               v1.8.0  Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util                v1.8.0  Symfony utilities for portability of PHP codes
symfony/swiftmailer-bundle           v2.6.7  Symfony SwiftmailerBundle
symfony/symfony                      v3.4.11 The Symfony PHP framework
twig/twig                            v2.4.8  Twig, the flexible, fast, and secure template language for PHP

Upgrade to SF 3.4.12 didn't help.

@patryk-stawowczyk
Copy link

With double colon in ContainerControllerResolver method createController executes parent::createController($controller). There is throwing exception:

if (!class_exists($class)) {
    throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
}

In single colon controller is returing as a service:

$service = $this->container->get($controller);

@bytehead
Copy link
Member

And with version 2.0.4 everything works as expected?

@bytehead
Copy link
Member

@patryk-stawowczyk
Copy link

Yes.

In 2.0.5 and 2.0.6 changing uploader-bundle/Routing/RouteLoader.php:33 from:

['_controller' => $service.'::upload', '_format' => 'json'],

to

['_controller' => $service.':upload', '_format' => 'json'],

fixed the problem.

Maybe it's something with my configuration but php cant create new class from service id "oneup_uploader.controller.gallery"

bytehead added a commit that referenced this issue Jul 18, 2018
@bytehead
Copy link
Member

Give 2.0.7 a try :-)

@patryk-stawowczyk
Copy link

Thx for fast fix.

@bytehead
Copy link
Member

You're welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants