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

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线
  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流
  • ¥15 高价求中通快递查询接口