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

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 关于#极限编程#的问题,请各位专家解答!
  • ¥20 win11账户锁定时间设为0无法登录
  • ¥45 C#学生成绩管理系统
  • ¥15 VB.NET2022如何生成发布成exe文件
  • ¥30 matlab appdesigner私有函数嵌套整合
  • ¥15 vb6.0使用jmail接收smtp邮件并另存附件到D盘
  • ¥30 vb net 使用 sendMessage 如何输入鼠标坐标
  • ¥15 关于freesurfer使用freeview可视化的问题
  • ¥100 谁能在荣耀自带系统MagicOS版本下,隐藏手机桌面图标?
  • ¥15 求SC-LIWC词典!