Skip to content
This repository has been archived by the owner on Jul 4, 2018. It is now read-only.

Error after update to v2.2.3 #1621

Closed
nictrace opened this issue Mar 1, 2018 · 15 comments
Closed

Error after update to v2.2.3 #1621

nictrace opened this issue Mar 1, 2018 · 15 comments

Comments

@nictrace
Copy link

nictrace commented Mar 1, 2018

After update to v2.2.3 I got a ClassNotFoundException, while class MessageFormatter was non found.
Rollback to 2.2.2 fixes it
screenshot

@SpacePossum
Copy link
Contributor

Hi,
Looking at the code this error is caused because the code tries to load the MessageFormatter class which is available since SF 3.4.0 translation package. There is a BC-check for this in place but this doesn't seem to work for your setup.
Could you run the following command composer info for both the 2.2.2 and 2.2.3 setup (in the root of your project) and share the output? I'm curious about which other packages are installed by composer and think this info will help to figure out what is wrong.

@stof
Copy link
Contributor

stof commented Mar 1, 2018

The issue here is that the TranslationServiceProvider checks the implementation it should use based on Kernel::VERSION_ID < 30400. But this constant gives you the version of HttpKernel being used, not the version of symfony/translation being used.

Doing version checks on the kernel version does not work fine when installing components separately.

@hkdobrev
Copy link
Contributor

hkdobrev commented Mar 1, 2018

I think class checks are better even if they look hacky as well.

@stof
Copy link
Contributor

stof commented Mar 1, 2018

well, a class check is exactly what we need here: detecting the feature itself instead of trying to detect the version (frontend guys have learned this since years btw)

@nictrace
Copy link
Author

nictrace commented Mar 1, 2018

current packet configuration (working)

livestga@kenny:~/back.entilescraft.ru [0] $ `composer` info
doctrine/annotations        v1.4.0  Docblock Annotations Parser
doctrine/cache              v1.6.2  Caching library offering an object-orie...
doctrine/collections        v1.4.0  Collections Abstraction library
doctrine/common             v2.7.3  Common Library for Doctrine projects
doctrine/dbal               v2.5.13 Database Abstraction Layer
doctrine/inflector          v1.1.0  Common String Manipulations with regard...
doctrine/lexer              v1.0.1  Base library for a lexer that can be us...
gregwar/captcha             v1.1.5  Captcha generator
leafo/lessphp               v0.5.0  lessphp is a compiler for LESS written ...
leafo/scssphp               v0.7.5  scssphp is a compiler for SCSS written ...
monolog/monolog             1.23.0  Sends your logs to files, sockets, inbo...
paragonie/random_compat     v2.0.11 PHP 5.x polyfill for random_bytes() and...
pimple/pimple               v3.2.3  Pimple, a simple Dependency Injection C...
psr/container               1.0.0   Common Container Interface (PHP FIG PSR...
psr/log                     1.0.2   Common interface for logging libraries
silex/silex                 v2.2.2  The PHP micro-framework based on the Sy...
silex/web-profiler          v2.0.10 A WebProfiler for Silex
symfony/asset               v3.4.4  Symfony Asset Component
symfony/browser-kit         v3.4.4  Symfony BrowserKit Component
symfony/class-loader        v3.4.4  Symfony ClassLoader Component
symfony/config              v3.4.4  Symfony Config Component
symfony/console             v3.4.4  Symfony Console Component
symfony/css-selector        v3.4.4  Symfony CssSelector Component
symfony/debug               v3.4.4  Symfony Debug Component
symfony/dom-crawler         v3.4.4  Symfony DomCrawler Component
symfony/event-dispatcher    v3.4.4  Symfony EventDispatcher Component
symfony/filesystem          v3.4.4  Symfony Filesystem Component
symfony/finder              v3.4.4  Symfony Finder Component
symfony/form                v3.4.4  Symfony Form Component
symfony/http-foundation     v3.4.4  Symfony HttpFoundation Component
symfony/http-kernel         v3.4.4  Symfony HttpKernel Component
symfony/inflector           v3.4.4  Symfony Inflector Component
symfony/intl                v3.4.4  A PHP replacement layer for the C intl ...
symfony/monolog-bridge      v3.4.4  Symfony Monolog Bridge
symfony/options-resolver    v3.4.4  Symfony OptionsResolver Component
symfony/polyfill-intl-icu   v1.7.0  Symfony polyfill for intl's ICU-related...
symfony/polyfill-mbstring   v1.7.0  Symfony polyfill for the Mbstring exten...
symfony/polyfill-php56      v1.7.0  Symfony polyfill backporting some PHP 5...
symfony/polyfill-php70      v1.7.0  Symfony polyfill backporting some PHP 7...
symfony/polyfill-util       v1.7.0  Symfony utilities for portability of PH...
symfony/process             v3.4.4  Symfony Process Component
symfony/property-access     v3.4.4  Symfony PropertyAccess Component
symfony/routing             v3.2.14 Symfony Routing Component
symfony/security            v3.4.4  Symfony Security Component
symfony/stopwatch           v3.4.4  Symfony Stopwatch Component
symfony/translation         v3.2.14 Symfony Translation Component
symfony/twig-bridge         v3.4.4  Symfony Twig Bridge
symfony/validator           v3.2.14 Symfony Validator Component
symfony/var-dumper          v3.4.4  Symfony mechanism for exploring and dum...
symfony/web-profiler-bundle v3.4.4  Symfony WebProfilerBundle
symfony/yaml                v2.8.34 Symfony Yaml Component
twig/extensions             v1.5.1  Common additional features for Twig tha...
twig/twig                   v1.35.0 Twig, the flexible, fast, and secure 

@stof
Copy link
Contributor

stof commented Mar 1, 2018

@nictrace what would be interesting is the non-working list.

@nictrace
Copy link
Author

nictrace commented Mar 1, 2018

completely the same, except silex version 2.2.3

@SpacePossum
Copy link
Contributor

thanks for the info @nictrace

symfony/http-kernel         v3.4.4
symfony/translation         v3.2.14 

the confirms what @stof stated and should be patched with a class check indeed.
@stof which branch should the fix target, this faulty code is not in 2.2.1 nor in the master ?

philiplb added a commit to philiplb/CRUDlex that referenced this issue Mar 2, 2018
as it breaks with a "Error: Class 'Symfony\Component\Translation\Formatter\MessageFormatter' not found", see silexphp/Silex#1621
@SpacePossum
Copy link
Contributor

@fabpot (cc @stof ) any help about which branch to target is welcome so people know what to target for bug fix for 2.2.4 PR's :)

@fabpot
Copy link
Member

fabpot commented Mar 12, 2018

We don't have a 2.2 branch. We are always fixing bug on the master branch. So, the fix should go on master and be part of the 2.3 series. That's how we also work on Twig, and that allows to reduce the maintenance workload. In any case, 2.3 is just about adding Symfony 4 support, so no big deal to jump to 2.3.0 when it's ready IMHO.

@fabpot
Copy link
Member

fabpot commented Mar 12, 2018

... and now that I read the thread again, I understand the issue :) Let's say that we can to an exception here if that really important and create a 2.2.4 release with the bug fix. If someone can work on a patch, I will happily apply it locally and make a release.

@jibundeyare
Copy link

jibundeyare commented Mar 15, 2018

Is a patch like the following totally out of scope or not ?

diff --git a/src/Silex/Provider/TranslationServiceProvider.php b/src/Silex/Provider/TranslationServiceProvider.php
index 9b8caff..f99e234 100644
--- a/src/Silex/Provider/TranslationServiceProvider.php
+++ b/src/Silex/Provider/TranslationServiceProvider.php
@@ -79,7 +79,7 @@ class TranslationServiceProvider implements ServiceProviderInterface, EventListe
         }
 
         $app['translator.message_selector'] = function () {
-            if (Kernel::VERSION_ID < 30400) {
+            if (class_exists('Symfony\Component\Translation\MessageSelector')) {
                 return new MessageSelector();
             }

If it doesn't fit, please do not bash me.

@SpacePossum
Copy link
Contributor

thanks @jibundeyare , looks good (as an alternative there is #1627 if needed : ) )

@fabpot fabpot closed this as completed Mar 16, 2018
@jibundeyare
Copy link

@SpacePossum your PR looks much better to me.

@SpacePossum
Copy link
Contributor

It has been merged and shipped by fabpot , enjoy the new release with the fix!

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

Successfully merging a pull request may close this issue.

6 participants