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

version 1.1.0 broke phpunit on PHP 5.4 ~ PHP 5.6 #30

Closed
kinosang opened this issue Jul 27, 2017 · 7 comments
Closed

version 1.1.0 broke phpunit on PHP 5.4 ~ PHP 5.6 #30

kinosang opened this issue Jul 27, 2017 · 7 comments
Labels

Comments

@kinosang
Copy link

the changes on 1.1.0, such as

syntax error, unexpected ':', expecting ';' or '{' 

at vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php:95

broke phpunit on PHP 5.4 ~ PHP 5.6

Here's the dependency tree:

phpunit/phpunit 4.8.24 The PHP Unit Testing framework.
├──ext-dom *
├──ext-json *
├──ext-pcre *
├──ext-reflection *
├──ext-spl *
├──php >=5.3.3
├──phpspec/prophecy ^1.3.1
│  ├──doctrine/instantiator ^1.0.2
│  │  └──php >=5.3,<8.0-DEV

I wonder to know how to force composer to install the old release of doctrine/instantiator ^1.0.2.

@alcaeus
Copy link
Member

alcaeus commented Jul 27, 2017

See http://doctrine-project.org/2017/07/25/php-7.1-requirement-and-composer.html. Run composer update on PHP 5.x and you'll get a compatible version. Closing as invalid.

@biggianteye
Copy link

While that works, it's a bit ugly to have to do an update immediately after an install.

@Ocramius
Copy link
Member

If your install is broken, then that's just because the locked dependency set is not compatible with your PHP version, and they shouldn't be locked to that set in first place

@KeitelDOG
Copy link

I had that problem too. Here's what happened to. On a fresh Macbook Pro, High Sierra comes with php7, I configure Laravel and updated composer with php7. And then I switched to php5.6.31, which was incompatible with installed version of doctrine/instantiator.
I re run composer update and then it downgraded the doctrine dependencies and it works:

`- Updating mtdowling/cron-expression (v1.2.0 => v1.2.1): Loading from cache

  • Updating symfony/polyfill-util (v1.5.0 => v1.6.0): Downloading (100%)
  • Updating symfony/polyfill-php56 (v1.5.0 => v1.6.0): Downloading (100%)
  • Updating doctrine/inflector (v1.2.0 => v1.1.0): Downloading (100%)
  • Updating artesaos/seotools (dev-master => 0.10.0): Downloading (100%)
  • Updating doctrine/collections (v1.5.0 => v1.4.0): Downloading (100%)
  • Updating doctrine/cache (v1.7.1 => v1.6.2): Downloading (100%)
  • Updating doctrine/annotations (v1.5.0 => v1.4.0): Downloading (100%)
  • Updating doctrine/common (v2.8.1 => v2.7.3): Downloading (100%)
  • Updating doctrine/dbal (v2.6.2 => v2.5.13): Downloading (100%)
  • Updating jaybizzle/crawler-detect (v1.2.52 => v1.2.54): Downloading (100%)
  • Updating pragmarx/support (v0.8.3 => v0.8.5): Downloading (100%)
  • Updating doctrine/instantiator (1.1.0 => 1.0.5): Downloading (100%)
  • Updating maxmind-db/reader (v1.1.3 => v1.2.0): Downloading (100%)
  • Updating phpdocumentor/type-resolver (0.4.0 => 0.3.0): Downloading (100%)
  • Updating phpdocumentor/reflection-docblock (4.1.1 => 3.2.2): Downloading (100%)`

k00ni added a commit to SaftIng/Saft that referenced this issue Nov 10, 2017
…antiator

Idea to lower version of instantiator found here:
doctrine/instantiator#30

Travis throws the following error in the PHP 5.6 environment:

$ vendor/bin/phpunit --bootstrap Test/bootstrap-travis.php --coverage-clover
gen/coverage/clover.xml
PHP Parse error:  syntax error, unexpected ':', expecting ';' or '{' in
/home/travis/build/SaftIng/Saft.arc2/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php
on line 95
PHP Stack trace:
PHP   1. {main}()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/phpunit:52
PHP   3. PHPUnit_TextUI_Command->run()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/Command.php:100
PHP   4. PHPUnit_TextUI_Command->createRunner()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/Command.php:113
PHP   5. PHPUnit_TextUI_TestRunner->__construct()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/Command.php:178
PHP   6. PHPUnit_TextUI_TestRunner->getCodeCoverageFilter()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:64
PHP   7. PHPUnit_Util_Blacklist->getBlacklistedDirectories()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:1055
PHP   8. PHPUnit_Util_Blacklist->initialize()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:58
PHP   9. class_exists()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:91
PHP  10. spl_autoload_call()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:91
PHP  11. Composer\Autoload\ClassLoader->loadClass()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:91
PHP  12. Composer\Autoload\includeFile()
/home/travis/build/SaftIng/Saft.arc2/vendor/composer/ClassLoader.php:322
Parse error: syntax error, unexpected ':', expecting ';' or '{' in
/home/travis/build/SaftIng/Saft.arc2/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php
on line 95
Call Stack:
    0.0001     248792   1. {main}()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/phpunit:0
    0.0047     937472   2. PHPUnit_TextUI_Command::main()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/phpunit:52
    0.0047     944584   3. PHPUnit_TextUI_Command->run()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/Command.php:100
    0.0306    4251168   4. PHPUnit_TextUI_Command->createRunner()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/Command.php:113
    0.0320    4485040   5. PHPUnit_TextUI_TestRunner->__construct()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/Command.php:178
    0.0320    4485184   6. PHPUnit_TextUI_TestRunner->getCodeCoverageFilter()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:64
    0.0324    4549016   7. PHPUnit_Util_Blacklist->getBlacklistedDirectories()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:1055
    0.0324    4549160   8. PHPUnit_Util_Blacklist->initialize()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:58
    0.0392    5976448   9. class_exists()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:91
    0.0392    5976760  10. spl_autoload_call()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:91
    0.0392    5976816  11. Composer\Autoload\ClassLoader->loadClass()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:91
    0.0392    5977008  12. Composer\Autoload\includeFile()
/home/travis/build/SaftIng/Saft.arc2/vendor/composer/ClassLoader.php:322
k00ni added a commit to SaftIng/Saft.arc2 that referenced this issue Nov 10, 2017
…antiator

Idea to lower version of instantiator found here:
doctrine/instantiator#30

Travis throws the following error in the PHP 5.6 environment:

$ vendor/bin/phpunit --bootstrap Test/bootstrap-travis.php --coverage-clover
gen/coverage/clover.xml
PHP Parse error:  syntax error, unexpected ':', expecting ';' or '{' in
/home/travis/build/SaftIng/Saft.arc2/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php
on line 95
PHP Stack trace:
PHP   1. {main}()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/phpunit:52
PHP   3. PHPUnit_TextUI_Command->run()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/Command.php:100
PHP   4. PHPUnit_TextUI_Command->createRunner()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/Command.php:113
PHP   5. PHPUnit_TextUI_TestRunner->__construct()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/Command.php:178
PHP   6. PHPUnit_TextUI_TestRunner->getCodeCoverageFilter()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:64
PHP   7. PHPUnit_Util_Blacklist->getBlacklistedDirectories()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:1055
PHP   8. PHPUnit_Util_Blacklist->initialize()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:58
PHP   9. class_exists()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:91
PHP  10. spl_autoload_call()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:91
PHP  11. Composer\Autoload\ClassLoader->loadClass()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:91
PHP  12. Composer\Autoload\includeFile()
/home/travis/build/SaftIng/Saft.arc2/vendor/composer/ClassLoader.php:322
Parse error: syntax error, unexpected ':', expecting ';' or '{' in
/home/travis/build/SaftIng/Saft.arc2/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php
on line 95
Call Stack:
    0.0001     248792   1. {main}()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/phpunit:0
    0.0047     937472   2. PHPUnit_TextUI_Command::main()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/phpunit:52
    0.0047     944584   3. PHPUnit_TextUI_Command->run()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/Command.php:100
    0.0306    4251168   4. PHPUnit_TextUI_Command->createRunner()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/Command.php:113
    0.0320    4485040   5. PHPUnit_TextUI_TestRunner->__construct()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/Command.php:178
    0.0320    4485184   6. PHPUnit_TextUI_TestRunner->getCodeCoverageFilter()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:64
    0.0324    4549016   7. PHPUnit_Util_Blacklist->getBlacklistedDirectories()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:1055
    0.0324    4549160   8. PHPUnit_Util_Blacklist->initialize()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:58
    0.0392    5976448   9. class_exists()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:91
    0.0392    5976760  10. spl_autoload_call()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:91
    0.0392    5976816  11. Composer\Autoload\ClassLoader->loadClass()
/home/travis/build/SaftIng/Saft.arc2/vendor/phpunit/phpunit/src/Util/Blacklist.php:91
    0.0392    5977008  12. Composer\Autoload\includeFile()
/home/travis/build/SaftIng/Saft.arc2/vendor/composer/ClassLoader.php:322
@chippyash
Copy link

I am stunned at the level of arrogance from the doctrine team that considers removing a PHP major version not to be a BC break. But lesson learned. In future we should all pin to a feature version instead of allowing our systems to benefit from new features by pinning on the major version. Quite staggering.

However, for others that can't get to grips with the disappearance of PHP 5.X support in doctrine/instantiator V1.1.0, a simple fix is to put

"doctrine/instantiator": "1.0.5"

in your require-dev section. Phpunit, V 4* which uses it, will happily start working again.

@Ocramius
Copy link
Member

You can put ^1.0.0 and let the SAT deal with it. There is nothing breaking here, except what was already widely explained above and in the linked article.

If you run composer update and composer install on incompatible systems, or if you prepare deployment packages on a system that is incompatible with your production environment, you will get into trouble anyway.

@boly38
Copy link

boly38 commented May 24, 2018

Hi,
following tests on my side, and instead of setup a static "doctrine/instantiator" version's. I finally setup a target platform php version by adding a config::platform section to the composer.json, cf. example under (doc).

    "config": {
        "platform": {
            "php": "5.6.32"
        }
    },

After composer update, doctrine/instantiator version (in composer.lock) is resolved to:

            "name": "doctrine/instantiator",
            "version": "1.0.5",

my 2 cents.

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

No branches or pull requests

7 participants