升级时/升级后 symfony 4 到 5 缓存错误

问题描述 投票:0回答:1
  • 我的问题:将 symfony 4.4 升级到 5.0 时出现缓存错误(4.4 上的缓存清除工作)

  • php:升级时为7.2.5,升级前为7.1

  • 在将 symfony 4.4 更新到 5 之前,我已遵循此文档(symfony doc 4.4 到 5): https://symfony.com/doc/4.4/setup/upgrade_major.html

  • 我已经修复了所有折旧

  • composer require --dev symfony/phpunit-bridge

  • ./bin/phpunit
    并修复尽可能多的问题,只剩下一个:

        Stack trace:
        #0 [internal function]: array_merge(phpunit/phpunit: Array)
        #1 phar:///usr/local/bin/composer.phar/src/Composer/DependencyResolver/DefaultPolicy.php(84): call_user_func_array('array_merge', Array)
        #2 phar:///usr/local/bin/composer.phar/src/Composer/Command/ShowCommand.php(537): Composer\DependencyResolver\DefaultPolicy->selectPreferredPackages(Object(Composer\DependencyResolver\Pool), Array, Array)
    
    
    

当我执行“composer update“symfony/*””时,除了最后一部分(缓存:清除)之外,一切都正常:

```Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!
!!   // Clearing the cache for the dev environment with debug
!!   // true
!!
!!
!!  In FileLoader.php line 173:
!!
!!    Class "1\AdminController" does not exist in 
 /Applications/MAMP/htdocs/MyApplication/config/routes/../../src/Controller/ (which is being imported from "/A
!!    pplications/MAMP/htdocs/MyApplication/config/routes/annotations.yaml"). Make s
!!    ure annotations are installed and enabled.
!!
!!
!!  In AnnotationDirectoryLoader.php line 62:
!!
!!    Class "1\AdminController" does not exist
!!
!!
!!  cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>
!!
!!
Script @auto-scripts was called via post-update-cmd
  • 我的应用程序中没有 1/AdminController

  • AdminController是/Admin/中的第一个控制器

  • 如果我将资源更改为 /HomeController,我会得到相同的错误,但使用 1/HomeController

  • 注释.yaml:

    controllers
      resource: ../../src/Controller/
      type: annotation
    
    kernel:
      resource: ../../src/Kernel.php
      type: annotation
    
    
  • composer self-update
    什么都不改变

  • 这是我的 Composer.json

  "type": "project",
  "license": "proprietary",
  "require": {
    "php": "^7.2.5",
    "ext-ctype": "*",
    "ext-iconv": "*",
    "composer/package-versions-deprecated": "1.11.99.5",
    "doctrine/annotations": "^1.8",
    "doctrine/common": "^2",
    "doctrine/doctrine-bundle": "^2",
    "doctrine/doctrine-migrations-bundle": "^2",
    "doctrine/orm": "^2",
    "dompdf/dompdf": "^0.8.5",
    "phpdocumentor/reflection-docblock": "^4.3",
    "sensio/framework-extra-bundle": "^5.1",
    "symfony/apache-pack": "^1.0",
    "symfony/asset": "^5.0",
    "symfony/cache": "5.0.*",
    "symfony/config": "5.0.*",
    "symfony/console": "5.0.*",
    "symfony/dotenv": "^5.0",
    "symfony/error-handler": "^5.0",
    "symfony/event-dispatcher": "^5.0",
    "symfony/expression-language": "^5.0",
    "symfony/flex": "^1.3.1",
    "symfony/form": "^5.0",
    "symfony/framework-bundle": "^5.0",
    "symfony/http-client": "^5.0",
    "symfony/http-foundation": "^5.0",
    "symfony/http-kernel": "^5.0",
    "symfony/intl": "^5.0",
    "symfony/mailer": "^5.0",
    "symfony/monolog-bundle": "^3.1",
    "symfony/process": "^5.0",
    "symfony/property-access": "^5.0",
    "symfony/property-info": "^5.0",
    "symfony/security-bundle": "^5.0",
    "symfony/security-core": "^5.0",
    "symfony/security-guard": "^5.0",
    "symfony/security-http": "^5.0",
    "symfony/serializer": "^5.0",
    "symfony/translation": "^5.0",
    "symfony/twig-bundle": "^5.0",
    "symfony/validator": "^5.0",
    "symfony/web-link": "^5.0",
    "symfony/yaml": "^5.0",
    "twbs/bootstrap": "4.4.1",
    "twig/extra-bundle": "^2.12|^3.0",
    "twig/twig": "^2.12|^3.0"
  },
  "require-dev": {
    "doctrine/doctrine-fixtures-bundle": "^3.4.2",
    "fzaninotto/faker": "^1.9",
    "phpunit/phpunit": "^7.5",
    "symfony/browser-kit": "^5.0",
    "symfony/css-selector": "^5.0",
    "symfony/debug-bundle": "^5.0",
    "symfony/maker-bundle": "^1.14",
    "symfony/phpunit-bridge": "^6.1",
    "symfony/stopwatch": "^5.0",
    "symfony/web-profiler-bundle": "^5.0"
  },
  "config": {
    "preferred-install": {
      "*": "dist"
    },
    "platform": {
      "php": "7.2.5"
    },
    "sort-packages": true,
    "allow-plugins": {
      "ocramius/package-versions": true,
      "symfony/flex": true
    }
  },
  "autoload": {
    "psr-4": {
      "App\\": "src/"
    }
  },
  "autoload-dev": {
    "psr-4": {
      "App\\Tests\\": "tests/"
    }
  },
  "replace": {
    "paragonie/random_compat": "2.*",
    "symfony/polyfill-ctype": "*",
    "symfony/polyfill-iconv": "*",
    "symfony/polyfill-php71": "*",
    "symfony/polyfill-php70": "*",
    "symfony/polyfill-php56": "*"
  },
  "scripts": {
    "auto-scripts": {
      "cache:clear": "symfony-cmd",
      "assets:install %PUBLIC_DIR%": "symfony-cmd"
    },
    "post-install-cmd": [
      "@auto-scripts"
    ],
    "post-update-cmd": [
      "@auto-scripts"
    ]
  },
  "conflict": {
    "symfony/symfony": "*"
  },
  "extra": {
    "symfony": {
      "allow-contrib": false,
      "require": "5.0.*"
    }
  }
}


  


 


  
php symfony caching symfony5 clear-cache
1个回答
0
投票

也许你必须删除composer.lock和symfony.lock,并将symfony/flex更新到最低1.18,我更喜欢1.19.2或2.2.2。

© www.soinside.com 2019 - 2024. All rights reserved.