jjzjj

php - Symfony 3.3 从 3.2 : Compile Error: Cannot declare class Symfony\Bundle\SecurityBundle\Security\FirewallMap

coder 2024-04-18 原文

自从我从 symfony 3.2 更新到 3.3 后我遇到了一些问题,我得到了这个错误

Compile Error: Cannot declare class Symfony\Bundle\SecurityBundle\Security\FirewallMap, because the name is already in use
in classes.php (line 1709)
in ClassCollectionLoader.php (line 99)
at ClassCollectionLoader::load()in Kernel.php (line 428)
at Kernel->doLoadClassCache()in Kernel.php (line 112)
at Kernel->boot()in Kernel.php (line 168)
at Kernel->handle()in app_dev.php (line 12)
at {main}()in app_dev.php (line 0)

这很有趣,因为我只是通过浏览器访问 app_dev.php 时出现此错误,如果我直接执行

php app_dev.php

然后错误没有出现,我只是按照我应该的方式重定向到登录页面

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="1;url=http://:/login" />

        <title>Redirecting to http://:/login</title>
    </head>
    <body>
        Redirecting to <a href="http://:/login">http://:/login</a>.
    </body>
</html>

命令工作正常,我可以清除缓存,debout 路由...

有什么想法吗?

谢谢!

更新:这里是 app_dev.php 的内容

<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;

/** @var \Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../app/autoload.php';
Debug::enable();

$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

最佳答案

我有一个很可能是边缘案例,但也许它会对某人有所帮助。在 Twig 模板中,我使用了一个常量,并且在某个时候对对象命名空间中的斜线进行了双重转义:

{{ constant('App\\Entity\\\\MyClass::MY_CONSTANT') }}

应该是:

{{ constant('App\\Entity\\MyClass::MY_CONSTANT') }}

多余的斜杠导致出现此错误消息。

关于php - Symfony 3.3 从 3.2 : Compile Error: Cannot declare class Symfony\Bundle\SecurityBundle\Security\FirewallMap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44455209/

有关php - Symfony 3.3 从 3.2 : Compile Error: Cannot declare class Symfony\Bundle\SecurityBundle\Security\FirewallMap的更多相关文章

  1. ruby-on-rails - 新 Rails 项目 : 'bundle install' can't install rails in gemfile - 2

    我已经像这样安装了一个新的Rails项目:$railsnewsite它执行并到达:bundleinstall但是当它似乎尝试安装依赖项时我得到了这个错误Gem::Ext::BuildError:ERROR:Failedtobuildgemnativeextension./System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/rubyextconf.rbcheckingforlibkern/OSAtomic.h...yescreatingMakefilemake"DESTDIR="cleanmake"DESTDIR="

  2. ruby-on-rails - 不兼容的库版本 : nokogiri. bundle 需要 8.0.0 或更高版本,但 libiconv.2.dylib 提供 7.0.0 版本 - 2

    为了在我的mac上为一个rails项目安装mysql,我遵循了安装Homebrew软件和删除mac端口的在线建议。这是问题开始的地方。rails项目不会构建,我得到这个:[rake--prereqs]rakeaborted!dlopen(/Users/Parker/.rvm/gems/ruby-1.9.3-p448/gems/nokogiri-1.6.0/lib/nokogiri/nokogiri.bundle,9):Librarynotloaded:/opt/local/lib/libiconv.2.dylibReferencedfrom:/Users/Parker/.rvm/gem

  3. ruby-on-rails - bundle 安装尝试使用缓存文件 - 2

    当我尝试进行bundle安装时,我的gem_path和gem_home指向/usr/local/rvm/gems/我没有写入权限,并且由于权限无效而失败。因此,我已将两个路径都更改为我具有写入权限的本地目录。这样做时,我进行了bundle安装,我得到:bruno@test6:~$bundleinstallFetchinggemmetadatafromhttps://rubygems.org/.........Fetchinggemmetadatafromhttps://rubygems.org/..Bundler::GemspecError:Couldnotreadgemat/afs/

  4. 使用时 Rubygems 2.0.14 不是线程安全的 bundle 程序安装消息 - RUBYGEMS VERSION : 2. 4.5.1 - 2

    运行bundle安装时,我收到以下消息:Rubygems2.0.14isnotthreadsafe,soyourgemswillbeinstalledoneatatime.UpgradetoRubygems2.1.0orhighertoenableparallelgeminstallation.这很奇怪,因为在我的RubyGems环境中它说我的RubyGems版本是:2.4.5.1(见下文)~/w/Rafftopia❯❯❯gemenvRubyGemsEnvironment:-RUBYGEMSVERSION:2.4.5.1-RUBYVERSION:2.2.5(2016-04-26patc

  5. ruby-on-rails - 本地 gem 的“bundle 安装”没有解决依赖关系,而 'gem install' 可以 - 2

    我在目录“/home/enterprise/pkg”中有一个本地gem(enterprise-0.0.1.gem)。它依赖于active_directorygem(v1.5.5),这是在它的enterprise.gemspec文件中指定的,如下所示:-gem.add_dependency("active_directory")在我的应用程序的Gemfile中,我添加了以下行:-gem'enterprise','0.0.1',path=>'/home/enterprise/pkg'当我做的时候bundleinstall在我的应用程序的源目录中,只安装了企业gem。因此,我遇到了引用act

  6. ruby-on-rails - 应该将 gems 与该应用程序 bundle 在一起吗? - 2

    刚拿到一台新机器,我借此机会尝试了一些新东西。RVM很棒,我一直在使用gemset,但在阅读了一些博客文章后,我决定使用switch到rbenv并使用bundler专门管理我的gem,如RubyRoguesepisode45中所述。.我并没有那么多合作,如果我这样做,通常是与另外一两个人合作。bundler文档详细说明了通过运行将gem打包到vendor/cache目录中的能力:$bundlepackage$bundleinstall--local伟大的私有(private)gem,可以checkin源代码控制;我想部署到一个干净的服务器或更容易协作?但是,如果您将Gemfile和Ge

  7. c - 我是如何让 gcc 生成 .bundle 而不是 .so 的? - 2

    我正在尝试编写一个Ruby扩展,而且我一整天都在成功编译我的nmatrix.so共享对象文件。但是,突然之间,它开始生成nmatrix.bundle,而根本没有任何.so文件。它没有给我任何链接器错误,所以我无法想象为什么会这样。我也没有更改myMakefileorextconf.rb中的任何内容.我一直通过rvm使用Ruby1.9.3p0。我已经尝试对当天的工作执行gitstashsave并编译一些我知道应该没有链接器错误的东西(产生.so的东西)更早。不幸的是,这也会生成一个.bundle文件。很明显,我做了一些事情——可能是无意中安装了一些东西——这改变了一些关键的GCC设置。这

  8. ruby-on-rails - bundle : Permission denied - 2

    我将服务器更新为ruby​​2.1.1,并使用Capistrano部署到我的服务器。但是,当我部署时,我收到各种错误。每次我玩我的部署代码时都会改变。以下是我当前遇到的问题。更新/新问题重新安装rvm和ruby​​后,我在部署时遇到了不同的问题。这是我当前的deploy.rb文件。require"bundler/capistrano"require"rvm/capistrano"set:rvm_type,:systemset:rvm_ruby_string,"ruby-2.1.1"require'bundler/capistrano'#Capistranoset:default_env

  9. Spring Security 6.0系列【32】授权服务器篇之默认过滤器 - 2

    有道无术,术尚可求,有术无道,止于术。本系列SpringBoot版本3.0.4本系列SpringSecurity版本6.0.2本系列SpringAuthorizationServer版本1.0.2源码地址:https://gitee.com/pearl-organization/study-spring-security-demo文章目录前言1.OAuth2AuthorizationServerMetadataEndpointFilter2.OAuth2AuthorizationEndpointFilter3.OidcProviderConfigurationEndpointFilter4.N

  10. ruby-on-rails - bundle exec rake 测试抛出错误 - 2

    你好,我是铁路新手。我正在关注MichaelHartl的railstutorial.org。我卡在了第4章的list4.5中:当我点击$bundleexecraketest时,它显示的结果与按照教程应该显示的结果不同。注意:我使用的是Ubuntu15.10作为平台。当我点击$bundleexecraketest时的结果/home/shyambhimani/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-reporters-1.0.5/lib/minitest/minitest_reporter_plugin.rb:8:in

随机推荐