Framework: Problem with Doctrine instantiator

Created on 25 Jul 2017  路  31Comments  路  Source: laravel/framework

  • Laravel Version: 5.4.30
  • PHP Version: 7.0.15
  • Database Driver & Version: mysql 5.5

Description:

When trying to update with composer the following error occurs:

Problem 1
    - Installation request for doctrine/instantiator 1.1.0 -> satisfiable by doctrine/instantiator[1.1.0].
    - doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.15) does not satisfy that requirement.

It looks like this bug was introduced with the following PR: #20227

Steps To Reproduce:

run composer update

Most helpful comment

The simple temporary solution until you update your server interpreted from http://doctrine-project.org/2017/07/25/php-7.1-requirement-and-composer.html :

  1. In your development folder, go to your composer.json. At the bottom of the file is a "config" option. Change it to this:
    "config": {
    "preferred-install": "dist",
    "sort-packages": true,
    "optimize-autoloader": true,
    "platform": {"php": "[WHATEVER YOUR SERVER PHP VERSION IS E.G: 7.0]"}
    }
  2. Save file and run composer update
  3. Push new composer.lock file to your server
  4. Run composer install on your server

All 31 comments

Same happens with my composer at the moment

has been fixed in: https://github.com/laravel/framework/pull/20227 which hasn't been tagged yet

no it's not fixed yet. the PR don't fix the composer.lock problem ( should be fixed in laravel/installer )
but introduce a new one.

@lk77 How does it introduce a new one?

@themsaid 1.1 requie php 7.1 at least

@lk77 that PR was to update doctrine/inflector not doctrine/instantiator, and doctrine/inflector 1.1 doesn't require php7.1

sorry my bad, this issue is not related with the PR, it was strange to me to see the requirement change, but it's not the good package^^

@GertjanRoke I don't see any vendor or laravel itself requiring doctrine/instantiator 1.1, could be a package you installed. A fresh laravel 5.4 application with my latest PR works on php 5.6, just tried it.

Im getting this with a fresh install of laravel when I run composer install on a production nginx amazon linux ec2 php 7.0.* installed.

@themsaid or really? Sorry then, I will check it today and if I find it I will let you know or close this issue.

I don't see any vendor or laravel itself requiring doctrine/instantiator 1.1, could be a package you installed. A fresh laravel 5.4 application with my latest PR works on php 5.6, just tried it.

@themsaid
image

The problem is that doctrine decided to increase the minimum version in a minor release, all packages using the doctrine affected packages need to fix their version requirement on the previous minor to avoid such problems, we've done that for Laravel so far. Closing this since there's nothing more we can do, all other packages has to do the same.

Well, I guess the blame is on Doctrine in this case. They really need to get semver in the rigth way

@RamonSmit not really. Its a "doubtful-zone" : http://semver.org/#what-should-i-do-if-i-update-my-own-dependencies-without-changing-the-public-api

@GertjanRoke you can check both the PRs. Both libraries didn't have any issues.

@Dylan-DPC I saw your PRs, Thanks for that.

What about 5.3 ?

Still can't deploy on envoyer:

Problem 1

  • Installation request for doctrine/instantiator 1.1.0 -> satisfiable by doctrine/instantiator[1.1.0].
  • doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.12) does not satisfy that requirement.

Problem 2

  • doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.12) does not satisfy that requirement.
  • phpunit/phpunit-mock-objects 3.4.4 requires doctrine/instantiator ^1.0.2 -> satisfiable by doctrine/instantiator[1.1.0].
  • Installation request for phpunit/phpunit-mock-objects 3.4.4 -> satisfiable by phpunit/phpunit-mock-objects[3.4.4].

I think it's a problem with phpunit, try ~5.7 or lower, but it should work on ~6.0
When installing on php7.0 it's working for me.

you need doctrine/instantiator 1.0.5, i don't know why it's installing 1.1.0
when i'm doing this

composer require phpunit/phpunit-mock-objects 3.4.4 --update-with-dependencies
composer require doctrine/instantiator ^1.0.2 --update-with-dependencies

it's working on 7.0,
it's installing doctrine/instantiator 1.0.5 , as expected.

No chance ... deploy fails with the same errors. I set phpunit to 5.6 updated composer and ran your 2 commands. No effects.
When running your first composer require I get:
Dependency "doctrine/instantiator" is also a root requirement, but is not explicitly whitelisted. Ignoring.

Meh you don't need to do all that:
just read this link

@Dylan-DPC yeah that did it for me! Thanks a lot.

I started a Laravel 5.4 project yesterday on my home pc with php 7.1 and checked out same on laptop with php 7.0. I ran into same error.
I read the link but I am still not sure what is fix here, What should I add to my composer.json in order to just stick with php 7.0 please suggest.

you can use platform.config to override your phpversion.
delete old composer.lock if you have one or do composer update.

If you are using PHP 7.0 you don't need to do anything. Since new minor version of doctrine package is PHP 7.1+, composer shouuld pick the earlier version directly unless there is a conflict with another dependency. Would advise you to seek help either on forums or slack channel.

I wish people would be sensitive to what platforms officially support PHP 7.1, forcing people to install unofficial repositories is frustrating. Even looking for a workaround is frustrating.

You don't have to force people to upgrade 7.1. The folks using 7.0 or below can still use the previous minor version (if there is no conflict with other packages).

Also do remember that PHP 7.0 has 3 months left of active support (which will mean it will recieve only security fixes for a year) so its high time vendors or whoever concerned should look into releasing official packages

@Dylan-DPC Agreed! Perhaps the PHP community should work on official releases for different distributions.

The simple temporary solution until you update your server interpreted from http://doctrine-project.org/2017/07/25/php-7.1-requirement-and-composer.html :

  1. In your development folder, go to your composer.json. At the bottom of the file is a "config" option. Change it to this:
    "config": {
    "preferred-install": "dist",
    "sort-packages": true,
    "optimize-autoloader": true,
    "platform": {"php": "[WHATEVER YOUR SERVER PHP VERSION IS E.G: 7.0]"}
    }
  2. Save file and run composer update
  3. Push new composer.lock file to your server
  4. Run composer install on your server

Thanks @lk77 , you saved me. I ran the second command and the problem was fixed.

Thanks @lk77, it saved my friday's afternoon.

@kgwebsites is the boss!

Was this page helpful?
0 / 5 - 0 ratings