DominikAngerer DominikAngerer - 1 year ago 100
Apache Configuration Question

PHP Catchable Fatal Error - on server

Currently facing an issue with a new Silex (Symfony) PHP application. If I start it locally like

php -S localhost:8080
everything works fine right away. I directly get an 500 Internal Server Error with the following log output after uploading it on the server:

[Tue Jan 19 16:15:24 2016] [error] [client 62.99.210.9] PHP Catchable fatal error:
Argument 2 passed to Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent::
__construct() must be an instance of Symfony\\Component\\HttpKernel\\Event\\callable,
instance of Closure given, called in /appl/www/htdocs/XXX/static/dashboard/php/
vendor/symfony/http-kernel/HttpKernel.php on line 131 and defined in /appl/www/htdocs/XXX/static/dashboard/php/
vendor/symfony/http-kernel/Event/FilterControllerEvent.php on line 35


composer.json:

{
"require": {
"silex/silex": "~1.2",
"twig/twig" : "1.*",
"symfony/twig-bridge": "2.1.*"
},
"minimum-stability": "dev",
"config": {
"vendor-dir": "php/vendor"
}
}


Any ideas on what causes such an error appreciated.

PHP Version: PHP 5.3.3 (cli) (built: Oct 23 2014 06:58:46)

Answer Source

Callable type hint is available since PHP 5.4

Callbacks can be denoted by callable type hint as of PHP 5.4. This documentation used callback type information for the same purpose.

http://php.net/manual/en/language.types.callable.php

What's happening here is PHP tries to resolve type hint "callable" to class name and since there is no namespace provided it looks for a class "Symfony\Component\HttpKernel\Event\callable" which obviously doesn't exist.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download