douzhang5199
2019-07-06 16:47
浏览 734
已采纳

PHP 7.2抛出运行“composer require symfony / dotenv”,7.1没有

A Symfony 4.2 application built (& working) in PHP 7.1, when switched to 7.2 throws

Fatal error: Uncaught RuntimeException: Please run "composer require symfony/dotenv" to load the ".env" files configuring the application...

Further, composer update yields Nothing to install or update and then

Script cache:clear returned with error code 255 !! !! Fatal error: Uncaught RuntimeException: You need to add "symfony/framework-bundle" as a Composer dependency. in G:\Documents\workspace\mana\bin\console:14

After updating composer.json to require PHP 7.2, it now includes:

"require": {
    "php": "^7.2",
    "ext-ctype": "*",
    "ext-iconv": "*",
    "beberlei/doctrineextensions": "^1.1",
    "easycorp/easyadmin-bundle": "^2.0",
    "knplabs/knp-snappy-bundle": "^1.6",
    "ob/highcharts-bundle": "^1.6",
    "sensio/framework-extra-bundle": "^5.1",
    "symfony/asset": "4.2.*",
    "symfony/console": "4.2.*",
    "symfony/dotenv": "4.2.*",
    "symfony/expression-language": "4.2.*",
    "symfony/flex": "^1.1",
    "symfony/form": "4.2.*",
    "symfony/framework-bundle": "4.2.*",
    "symfony/monolog-bundle": "^3.1",
    "symfony/orm-pack": "*",
    "symfony/process": "4.2.*",
    "symfony/security-bundle": "4.2.*",
    "symfony/serializer-pack": "*",
    "symfony/swiftmailer-bundle": "^3.1",
    "symfony/templating": "4.2.*",
    "symfony/test-pack": "^1.0",
    "symfony/translation": "4.2.*",
    "symfony/twig-bundle": "4.2.*",
    "symfony/validator": "4.2.*",
    "symfony/web-link": "4.2.*",
    "symfony/webpack-encore-bundle": "^1.0",
    "symfony/yaml": "4.2.*"
},

Edit: If, as suggested in the error message, composer update is run, the following occurs. As can be seen in composer.json above, this is nonsensical.

Fatal error: Uncaught RuntimeException: You need to add "symfony/framework-bundle" as a Composer dependency. in G:\Documents\workspace\mana\bin\console:14

Edit #2: This does not appear to be a Symfony or a PHP issue. I'm working in Windows and have a Hyper-V Ububtu 18 server running a clone of the app in Apache/2.4.29, PHP Version 7.2.19 without a problem. Makes it a whole lot harder to sort out. Place this Q on hold?

Edit #3: Restored a two month old Windows image and got the same effect. Returned to current image and learned that the errors described above start somewhere between PHP 7.10 & 7.16 on this box. Upgrading Symfony to 4.3 does not help. ARRRGGGHHH!

Final edit: Sorting this out is beyond my skill set. I'll end with the output of PHP 7.2.20. There is no dev.log created. Netbeans 11 does not seem to recognize xdebug. Here:

(1/1) FatalErrorException

Error: During class fetch: Uncaught ReflectionException: Class PHPUnit\Framework\TestCase not found in G:\Documents\workspace\mana\vendor\symfony\framework-bundle\Test\KernelTestCase.php:24 Stack trace:

0 G:\Documents\workspace\mana\vendor\symfony\debug\DebugClassLoader.php(159):

require('G:\Documents\wo...')

1 [internal function]: Symfony\Component\Debug\DebugClassLoader->loadClass('Symfony\Bundle\...')

2 G:\Documents\workspace\mana\vendor\symfony\framework-bundle\Test\WebTestCase.php(22):

spl_autoload_call('Symfony\Bundle\...')

3 G:\Documents\workspace\mana\vendor\symfony\debug\DebugClassLoader.php(159):

require('G:\Documents\wo...')

4 [internal function]: Symfony\Component\Debug\DebugClassLoader->loadClass('Symfony\Bundle\...')

5 G:\Documents\workspace\mana\vendor\liip\functional-test-bundle\src\Test\WebTestCase.php(41):

spl_autoload_call('Symfony\Bundle\...')

6 G:\Documents\workspace\mana\vendor\symfony\debug\DebugClassLoader.php(159):

require('G:\Documents\wo...')

7 [internal function]: Sy in KernelTestCase.php line 24

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duanliaouu965826 2019-07-08 18:19
    已采纳

    Got unstuck using the simplest possible solution - moving all the way up to PHP 7.3.7.

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题