FOSRestBundle & JMSSerializerBundle with symfony 2.7 and PHP 5.5.12 - symfony

I'd like to add the 2 libraries FOSRestBundle & JMSSerializerBundle to my application built with symfony 2.7 but i encountred this response
Problem 1
- Installation request for friendsofsymfony/rest-bundle dev-master -> satisfiable by friendsofsymfony/rest-bundle[dev-master].
- friendsofsymfony/rest-bundle dev-master requires php ^5.5.9|~7.0 -> your PHP version (5.5.12) overriden by "config.platform.php" version (5.3.9) does not satisfy that requirement.
Problem 2
- Installation request for jms/serializer-bundle dev-master -> satisfiable by jms/serializer-bundle[dev-master].
- jms/serializer-bundle dev-master requires php >=5.4.0 -> your PHP version (5.5.12) overriden by "config.platform.php" version (5.3.9) does not satisfy that requirement.
Notice that PHP version is 5.5.12
I think the problem is the version of this 2 libraries. If yes, What are the versions of FOSRestBundle & JMSSerializerBundle ?

dev-master should never be used as version bound when requiring a package as dependency, except in some specific cases.
Go to https://packagist.org/ then search for the packages you are looking for and use their respective current stable version as version bound for your composer.json's requirement.
Also, in your composer.json, you have a config key containing a platform.php key with 5.3.9 as value. Remove or override this block according to your real PHP version. See Symfony2, composer, your PHP version (5.6.18) overriden by "config.platform.php" version (5.3.9) does not satisfy requirement.
Of course, if the last stable version of one of them isn't compatible with your environment (PHP >= 5.5.9 for friendsofsymfony/rest-bundle), you need to look for an older version supporting your environment (all is available on packagist, and surely on the official documentation of these packages).

Related

Composer update probleme on cpanel for symfony

I have a problem for a symfony app when I try to install dependencies with composer :
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/framework-bundle[v6.0.0, ..., v6.0.12] require composer-runtime-api >=2.1 -> found composer-runtime-api[2.0.0] but it does not match the constraint.
- Root composer.json requires symfony/framework-bundle 6.0.* -> satisfiable by symfony/framework-bundle[v6.0.0, ..., v6.0.12].
Composer version I have on cpanel : 2.0.8
I didn't upgrade composer to the last version.
symfony/framework-bundle[v6.0.0, ..., v6.0.12] require composer-runtime-api >=2.1 -> found composer-runtime-api[2.0.0] but it does not match the constraint.
That line basically tells you that Symfony in v6 requires any Composer version equal or above 2.1, and you are currently using Composer v2.0. Please update Composer itself, for example by using composer self-update

symfony 4.4 + sonata deprecations like sonata.deprecated_text.twig.extension | sonata.twig.deprecated_template_extension

I've installed sonata + symfony 4.4 on new clean empty project.
Did everything according to https://symfony.com/doc/current/bundles/SonataAdminBundle/getting_started/installation.html
and executed the recipes , composer adviced me to apply.
But on pristine setup I'm having a few deprecations like:
User Deprecated: The "sonata.twig.deprecated_template_extension"
service is deprecated since sonata-project/twig-extensions 1.4.
User Deprecated: The "sonata.deprecated_text.twig.extension" service
is deprecated since sonata-project/admin-bundle 3.70. You should stop
using it, as it will be removed in 4.0.
The child node "legacy_twig_text_extension" at path
"sonata_admin.options" is deprecated since sonata-project/admin-bundle
3.70 and will be removed in 4.0.
Is it ok? I don't have any legacy I've just set up compeltely new project?
Can I somehow avoid these deprecations or is it just an expected behavior and I have to get used to it?

Symfony - FOSUserBundle Profile view does not work after update to Symfony 2.8

I have upgraded my Symfony project from version 2.6 to 2.8 and after that, I receive an error 500 when I request the profile view. The error is:
Error: Call to a member function has() on null
Stack Trace in vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php at line 350 -
*/
public function getUser()
{
if (!$this->container->has('security.token_storage')) {
throw new \LogicException('The SecurityBundle is not registered in your application.');
}
When I run composer show -i, I see the next list:
You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.
doctrine/annotations v1.4.0 Docblock Annotations Parser
doctrine/cache v1.6.2 Caching library offering a...
doctrine/collections v1.4.0 Collections Abstraction li...
doctrine/common v2.7.3 Common Library for Doctrin...
doctrine/dbal v2.5.13 Database Abstraction Layer
doctrine/doctrine-bundle 1.8.1 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle 1.3.2 Symfony Bundle for Doctrin...
doctrine/inflector v1.1.0 Common String Manipulation...
doctrine/instantiator 1.0.5 A small, lightweight utili...
doctrine/lexer v1.0.1 Base library for a lexer t...
doctrine/orm v2.5.14 Object-Relational-Mapper f...
friendsofsymfony/jsrouting-bundle 1.5.3 A pretty nice way to expos...
friendsofsymfony/oauth-server-bundle 1.5.0 Symfony2 OAuth Server Bundle
friendsofsymfony/oauth2-php 1.2.2 OAuth2 library
friendsofsymfony/user-bundle dev-master 9b3be01 Symfony FOSUserBundle
incenteev/composer-parameter-handler v2.1.2 Composer script handling y...
ircmaxell/password-compat v1.0.4 A compatibility library fo...
jdorn/sql-formatter v1.2.17 a PHP SQL highlighting lib...
jms/aop-bundle 1.3.0 Adds AOP capabilities to S...
jms/cg 1.2.0 Toolset for generating PHP...
jms/di-extra-bundle 1.9.1 Allows to configure depend...
jms/metadata 1.6.0 Class/method/property meta...
jms/parser-lib 1.0.0 A library for easily creat...
jms/security-extra-bundle dev-master c4a5dda Enhances the Symfony2 Secu...
knplabs/knp-snappy v1.0.4 PHP5 library allowing thum...
knplabs/knp-snappy-bundle v1.5 Easily create PDF and imag...
kriswallsmith/assetic v1.4.0 Asset Management for PHP
liuggio/ExcelBundle v2.1.0 This is a Symfony2 Bundle ...
monolog/monolog 1.23.0 Sends your logs to files, ...
paragonie/random_compat v2.0.11 PHP 5.x polyfill for rando...
phpoffice/phpexcel 1.8.1 PHPExcel - OpenXML - Read,...
phpoption/phpoption 1.5.0 Option Type for PHP
phpunit/php-code-coverage 1.2.18 Library that provides coll...
phpunit/php-file-iterator 1.4.5 FilterIterator implementat...
phpunit/php-text-template 1.2.1 Simple template engine.
phpunit/php-timer 1.0.9 Utility class for timing
phpunit/php-token-stream 1.2.2 Wrapper around PHP's token...
phpunit/phpunit 3.7.38 The PHP Unit Testing frame...
phpunit/phpunit-mock-objects 1.2.3 Mock Object library for PH...
psr/log 1.0.2 Common interface for loggi...
sensio/distribution-bundle v2.3.22 The base bundle for the Sy...
sensio/framework-extra-bundle v3.0.29 This bundle provides a way...
sensio/generator-bundle v2.5.3 This bundle generates code...
stripe/stripe-php v3.23.0 Stripe PHP Library
swiftmailer/swiftmailer v5.4.9 Swiftmailer, free feature-...
symfony/assetic-bundle v2.8.2 Integrates Assetic into Sy...
symfony/monolog-bundle v2.12.1 Symfony MonologBundle
symfony/polyfill-intl-icu v1.7.0 Symfony polyfill for intl'...
symfony/polyfill-mbstring v1.7.0 Symfony polyfill for the M...
symfony/polyfill-php54 v1.7.0 Symfony polyfill backporti...
symfony/polyfill-php55 v1.7.0 Symfony polyfill backporti...
symfony/polyfill-php56 v1.7.0 Symfony polyfill backporti...
symfony/polyfill-php70 v1.7.0 Symfony polyfill backporti...
symfony/polyfill-util v1.7.0 Symfony utilities for port...
symfony/security-acl v2.8.0 Symfony Security Component...
symfony/swiftmailer-bundle v2.6.7 Symfony SwiftmailerBundle
symfony/symfony v2.8.0 The Symfony PHP framework
twig/extensions v1.5.1 Common additional features...
twig/twig v1.35.0 Twig, the flexible, fast, ...
willdurand/jsonp-callback-validator v1.1.0 JSONP callback validator.
I have been researching for hours and I havenĀ“t found useful information about this error.
Thanks in advance.
The issue is in your Controllers. Probably they extend Symfony\Component\ DependencyInjection\ContainerAware that is deprecated since version 2.8. Remove this and use Symfony\ Component\DependencyInjection\ ContainerAwareTrait.
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
class MyBundleController implements ContainerAwareInterface {
use ContainerAwareTrait;
/**
* #Route("/", name="_index")
* #Template()
*/
public function indexAction() {
var_dump($this->container);
return array();
}
}
Edit: Cerad was right in the comments:
there is is not need to rewrite your existing controllers that extend from Controller. The problem is in third party bundles like the FOSUserBundle which do not extend from Controller. However, even they should still work under 2.8 or at least give different errors.
It should work in either case.
References:
ref 1
Symfony 2.8 upgrade -> ContainerAwareTrait

Unable to update dompdf via Composer in Drupal 8

We are in the midst of trying to get all of our Drupal modules that were not installed using Composer to be managed within Composer.
Composer: 1.4.12
Drupal: 8.3.1
After clearing Composer's cache, we ran the following:
./composer require dompdf/dompdf;
This returns:
./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Can only install one of: phenx/php-svg-lib[v0.2, 0.1].
- Can only install one of: phenx/php-svg-lib[v0.2, 0.1].
- Can only install one of: phenx/php-svg-lib[v0.2, 0.1].
- dompdf/dompdf v0.8.0 requires phenx/php-svg-lib 0.2.* -> satisfiable by phenx/php-svg-lib[v0.2].
- Installation request for dompdf/dompdf ^0.8.0 -> satisfiable by dompdf/dompdf[v0.8.0].
- Installation request for phenx/php-svg-lib (locked at 0.1) -> satisfiable by phenx/php-svg-lib[0.1].
Installation failed, reverting ./composer.json to its original content.
It seems like the proper thing to do would be to not lock "phenx/php-svg-lib" to version 0.1, then upgrade dompdf, however when we modified dompdf's composer.json file to require phenx/php-svg-lib version 0.2.*, clearcache, then try require again, we get the same error as above, which still references the lock at 0.1. I've also confirmed that dompdf is the only vendor module that is using phenx/php-svg-lib.
Also, is there a reason why "Can only install one of" is listed three times?
Thank you in advance for any advice.
It appears like this problem happens when updating dompdf from version 0.7.0 to 0.8.0. For some reason, the update works perfectly fine with composer 1.2.x, but does result with the above error with version 1.4.x.
The fix that did the job for me was to remove
"dompdf/dompdf": "^0.7.0"
from the composer.json file and then run:
composer update
The result should be something like:
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 0 updates, 3 removals
- Removing dompdf/dompdf (v0.7.0)
- Removing phenx/php-font-lib (0.4)
- Removing phenx/php-svg-lib (0.1)
Writing lock file
Generating autoload files
Then require a new version:
composer require dompdf/dompdf

The ability to pass file names to the Symfony\Component\Yaml\Yaml::parse method is deprecated

I'm new to Symfony2 and working on it for now nearly 3 weeks.
Things are going well but I have 4 deprecated warning at each page that require doctrine to interact (mapping is done through yaml file), whatever the entity used.
The ability to pass file names to the
Symfony\Component\Yaml\Yaml::parse method is deprecated since version
2.2 and will be removed in 3.0. Pass the YAML contents of the file instead. (4 times)
I don't know what I did wrong, or if there is a problem somewhere I can fix to get rid of the warns.
Thank you for your help !
Just in case, here is the full stacktrace :
Yaml::parse() (called from YamlDriver.php at line 712)
YamlDriver::loadMappingFile() (called from FileDriver.php at line 115)
FileDriver::getElement() (called from YamlDriver.php at line 55)
YamlDriver::loadMetadataForClass() (called from MappingDriverChain.php at line 102)
MappingDriverChain::loadMetadataForClass() (called from ClassMetadataFactory.php at line 116)
ClassMetadataFactory::doLoadMetadata() (called from AbstractClassMetadataFactory.php at line 332)
AbstractClassMetadataFactory::loadMetadata() (called from AbstractClassMetadataFactory.php at line 216)
AbstractClassMetadataFactory::getMetadataFor() (called from EntityManager.php at line 265)
EntityManager::getClassMetadata() (called from DefaultRepositoryFactory.php at line 67)
DefaultRepositoryFactory::createRepository() (called from DefaultRepositoryFactory.php at line 50)
DefaultRepositoryFactory::getRepository() (called from EntityManager.php at line 665)
EntityManager::getRepository() (called from UserManager.php at line 40)
UserManager::__construct() (called from appDevDebugProjectContainer.php at line 1582)
appDevDebugProjectContainer::getFosUser_UserManagerService() (called from Container.php at line 312)
Container::get() (called from appDevDebugProjectContainer.php at line 3632)
appDevDebugProjectContainer::getFosUser_UserProvider_UsernameService() (called from Container.php at line 312)
Container::get() (called from appDevDebugProjectContainer.php at line 3690)
appDevDebugProjectContainer::getSecurity_Authentication_ManagerService() (called from Container.php at line 312)
Container::get() (called from appDevDebugProjectContainer.php at line 2299)
appDevDebugProjectContainer::getSecurity_Firewall_Map_Context_MainService() (called from Container.php at line 312)
Container::get() (called from classes.php at line 2964)
FirewallMap::getListeners() (called from classes.php at line 2606)
Firewall::onKernelRequest()
call_user_func() (called from WrappedListener.php at line 61)
WrappedListener::__invoke()
call_user_func() (called from classes.php at line 1853)
EventDispatcher::doDispatch() (called from classes.php at line 1771)
EventDispatcher::dispatch() (called from TraceableEventDispatcher.php at line 132)
TraceableEventDispatcher::dispatch() (called from HttpKernel.php at line 120)
HttpKernel::handleRaw() (called from HttpKernel.php at line 62)
HttpKernel::handle() (called from ContainerAwareHttpKernel.php at line 69)
ContainerAwareHttpKernel::handle() (called from Kernel.php at line 185)
Kernel::handle() (called from app_dev.php at line 30)
And if needed, the result of composer.phar show --installed
doctrine/annotations v1.2.7 Docblock Annotations Parser
doctrine/cache v1.5.4 Caching library offering an object-oriented API for many cache backends
doctrine/collections v1.3.0 Collections Abstraction library
doctrine/common v2.5.3 Common Library for Doctrine projects
doctrine/dbal v2.5.4 Database Abstraction Layer
doctrine/doctrine-bundle 1.6.2 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle 1.3.0 Symfony Bundle for Doctrine Cache
doctrine/inflector v1.1.0 Common String Manipulations with regard to casing and singular/plural rules.
doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm v2.4.8 Object-Relational-Mapper for PHP
friendsofsymfony/user-bundle v1.3.6 Symfony FOSUserBundle
incenteev/composer-parameter-handler v2.1.2 Composer script handling your ignored parameter file
ircmaxell/password-compat v1.0.4 A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash
jdorn/sql-formatter v1.2.17 a PHP SQL highlighting library
monolog/monolog 1.17.2 Sends your logs to files, sockets, inboxes, databases and various web services
paragonie/random_compat v1.2.0 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
psr/log 1.0.0 Common interface for logging libraries
sensio/distribution-bundle v5.0.4 Base bundle for Symfony Distributions
sensio/framework-extra-bundle v3.0.13 This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle v3.0.5 This bundle generates code for you
sensiolabs/security-checker v3.0.2 A security checker for your composer.lock
swiftmailer/swiftmailer v5.4.1 Swiftmailer, free feature-rich PHP mailer
symfony/monolog-bundle v2.8.2 Symfony MonologBundle
symfony/phpunit-bridge v2.8.2 Symfony PHPUnit Bridge
symfony/polyfill-intl-icu v1.1.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring v1.1.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php54 v1.1.0 Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions
symfony/polyfill-php55 v1.1.0 Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions
symfony/polyfill-php56 v1.1.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70 v1.1.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util v1.1.0 Symfony utilities for portability of PHP codes
symfony/security-acl v2.8.0 Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.3.11 Symfony SwiftmailerBundle
symfony/symfony v2.8.2 The Symfony PHP framework
twig/twig v1.24.0 Twig, the flexible, fast, and secure template language for PHP
EDIT
As suggested, I upgraded Doctrine to 2.5, after struggling with some dependancy problems.
Now I have only 2 notices, about stuff from security, which I'm currently working on, based on a deprecated tutorial. Commenting faulty line made notices disappear. Hooray !
As suggested by Cerad, I upgraded to Doctrine 2.5 by editing composer.json, and running composer update.
This generated new notices, but related to security stuff I've written in a deprecated way, easily fixed.
For anyone going through the same problem, be careful in your composer.json, Doctrine 2.5 requires php 5.4, and some config.platform.php was set to 5.3.9 for me, which blocked the update. Edit this too if you want to upgrade.
The ability to pass file names to Yaml::parse() has been removed.
Before: Yaml::parse($fileName);
After: Yaml::parse(file_get_contents($fileName));
source:
https://github.com/symfony/symfony/blob/master/UPGRADE-3.0.md#yaml
Probably you are not using explicity Yaml::parse. It is not a problem until you want to upgrade to 3.0. If you would you can except that change is covered by dependencies (possibly doctrine-bridge). If not you should stick to 2.7 LTS version of Symfony.
I just checked that 2.8 is also LTS. I'm not sure what is the difference.

Resources