Symfony 2.6〃;异常处理程序必须是有效的PHP可调用程序&”;


Symfony 2.6 "The exception handler must be a valid PHP callable."

我不完全确定这里出了什么问题,也不确定如何让它工作。我已经多次尝试从供应商/symfony中删除我的symfony文件,从composer安装中重新安装它们,并清除我的缓存。

有人知道是什么原因造成的吗?

CRITICAL - Uncaught PHP Exception LogicException: "The exception handler must be a valid PHP callable." at /var/www/html/allTheKisses/vendor/symfony/symfony/src/Symfony/Component/Debug/ExceptionHandler.php line 74 
DEBUG - Notified event "kernel.request" to listener "Symfony'Component'EventDispatcher'Debug'WrappedListener::__invoke". 
DEBUG - Notified event "kernel.request" to listener "Symfony'Component'EventDispatcher'Debug'WrappedListener::__invoke". 
DEBUG - Notified event "kernel.request" to listener "Symfony'Component'EventDispatcher'Debug'WrappedListener::__invoke". 
DEBUG - Notified event "kernel.request" to listener "Symfony'Component'EventDispatcher'Debug'WrappedListener::__invoke". 
DEBUG - Notified event "kernel.request" to listener "Symfony'Component'EventDispatcher'Debug'WrappedListener::__invoke". 
DEBUG - Notified event "kernel.request" to listener "Symfony'Component'EventDispatcher'Debug'WrappedListener::__invoke". 
DEBUG - Notified event "kernel.request" to listener "Symfony'Component'EventDispatcher'Debug'WrappedListener::__invoke". 
DEBUG - Notified event "kernel.request" to listener "Symfony'Component'EventDispatcher'Debug'WrappedListener::__invoke". 
DEBUG - Notified event "kernel.request" to listener "Symfony'Component'EventDispatcher'Debug'WrappedListener::__invoke". 
DEBUG - Notified event "kernel.controller" to listener "Symfony'Bundle'FrameworkBundle'DataCollector'RouterDataCollector::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Acme'DemoBundle'EventListener'ControllerListener::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Symfony'Component'HttpKernel'DataCollector'RequestDataCollector::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Sensio'Bundle'FrameworkExtraBundle'EventListener'ControllerListener::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Sensio'Bundle'FrameworkExtraBundle'EventListener'ParamConverterListener::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Sensio'Bundle'FrameworkExtraBundle'EventListener'HttpCacheListener::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Sensio'Bundle'FrameworkExtraBundle'EventListener'SecurityListener::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Sensio'Bundle'FrameworkExtraBundle'EventListener'TemplateListener::onKernelController". 

我的配置如下

imports:
    - { resource: parameters.yml }
    - { resource: security.yml }
framework:
    #esi:             ~
    #translator:      { fallback: "%locale%" }
    secret:          "%secret%"
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: ~
    form:            ~
    csrf_protection: ~
    validation:      { enable_annotations: true }
    templating:
        engines: ['twig']
        #assets_version: SomeVersionScheme
    default_locale:  "%locale%"
    trusted_hosts:   ~
    trusted_proxies: ~
    session:
        # handler_id set to null will use default session handler from php.ini
        handler_id:  ~
    fragments:       ~
    http_method_override: true
# Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"
    form:
      resources:
        - BraincraftedBootstrapBundle:Form:bootstrap.html.twig
# Assetic Configuration
assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    bundles:        [ GarethIndexBundle, GarethpPhotosBundle  ]
    node: /usr/bin/node
    node_paths: [/usr/lib/node_modules]
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
        less: ~
#            apply_to: "'.less$"
#        lessphp:
#            file: %kernel.root_dir%/../vendor/oyejorge/less.php/lessc.inc.php
#            apply_to: "'.less$"
        uglifycss:
            bin: /usr/bin/uglifycss
        uglifyjs2:
          bin: /usr/bin/uglifyjs
          apply_to:   "'.js"
        #closure:
        #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
        #yui_css:
        #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
braincrafted_bootstrap:
    less_filter: less
# Doctrine Configuration
doctrine:
    dbal:
        driver:   "%database_driver%"
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
        # if using pdo_sqlite as your database driver, add the path in parameters.yml
        # e.g. database_path: "%kernel.root_dir%/data/data.db3"
        # path:     "%database_path%"
    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
    transport: "%mailer_transport%"
    host:      "%mailer_host%"
    username:  "%mailer_user%"
    password:  "%mailer_password%"
    spool:     { type: memory }
gregwar_image:
    throw_exception: true

我遇到了类似的问题。

request.CRITICAL: Uncaught PHP Exception LogicException: "The exception handler must be a valid PHP callable." at .../app/cache/prod/classes.php line 1806 {"exception":"[object] (LogicException(code: 0): The exception handler must be a valid PHP callable. at .../app/cache/prod/classes.php:1806)"} []
request.CRITICAL: Uncaught PHP Exception LogicException: "The exception handler must be a valid PHP callable." at .../app/cache/prod/classes.php line 1806 {"exception":"[object] (LogicException(code: 0): The exception handler must be a valid PHP callable. at .../app/cache/prod/classes.php:1806)"} []
request.CRITICAL: Uncaught PHP Exception LogicException: "The exception handler must be a valid PHP callable." at .../app/cache/prod/classes.php line 1806 {"exception":"[object] (LogicException(code: 0): The exception handler must be a valid PHP callable. at .../app/cache/prod/classes.php:1806)"} []
request.CRITICAL: Uncaught PHP Exception LogicException: "The exception handler must be a valid PHP callable." at .../app/cache/prod/classes.php line 1806 {"exception":"[object] (LogicException(code: 0): The exception handler must be a valid PHP callable. at .../app/cache/prod/classes.php:1806)"} []
request.CRITICAL: Uncaught PHP Exception LogicException: "The exception handler must be a valid PHP callable." at .../app/cache/prod/classes.php line 1806 {"exception":"[object] (LogicException(code: 0): The exception handler must be a valid PHP callable. at .../app/cache/prod/classes.php:1806)"} []
request.CRITICAL: Uncaught PHP Exception LogicException: "The exception handler must be a valid PHP callable." at .../app/cache/prod/classes.php line 1806 {"exception":"[object] (LogicException(code: 0): The exception handler must be a valid PHP callable. at .../app/cache/prod/classes.php:1806)"} []

这是在我在本地机器上制作php composer update并仅将src/vendor/目录传输到生产服务器之后发生的。上传app/bootstrap.cache.php后,问题消失了。

我不太确定,但你可以称之为Debug::enable();。这会调用ExceptionHandler,并且ExceptionHandler::handle是可调用的,所以我不知道您的设置是做什么的。

试着找到这条Debug::enable();行并注释掉,看看错误是否已经消失。例如什么是

gregwar_image:
  throw_exception: true

是否有一个Gregwar ExceptionHandler扩展了它,而它的handle方法是不可调用的?