Symfony 2.6"异常处理程序必须是有效的PHP可调用的。"

时间:2015-02-17 23:47:42

标签: php symfony

我不完全确定这里有什么问题,或者如何让它发挥作用。我尝试从vendor / symfony中删除我的symfony文件,从composer install重新安装它们并多次清除我的缓存。

有没有人对可能导致这种情况的原因有任何想法?

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". 

我的config.yaml如下

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

2 个答案:

答案 0 :(得分:1)

我遇到了类似的问题。

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/ dirs传输到生产服务器后发生了这种情况。上传app/bootstrap.cache.php后问题就消失了。

答案 1 :(得分:0)

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

尝试找到此Debug::enable();行并将其注释掉,以查看错误是否消失。 例如

gregwar_image:
  throw_exception: true

是否可能有一个Gregwar ExceptionHandler扩展它并且它的handle方法不可调用?