Silex Problems with PHP 5.3.2?
php, silex
Solution
Silex requires PHP 5.3.3, as you can see in their `composer.json`:
"require": {
"php": ">=5.3.3",
...
And it also stated in the README file:
Silex works with PHP 5.3.3 or later.
This is due to the fact that Symfony2 is no longer supporting PHP 5.3.2.
Problem
I tried the examples from Silex and put my Controllers in a seperate directory and class. No the controller method will get the `Request` and `Application` objects passed by default. This works on my dev machine which has 5.3.14 but not on the default Ubuntu 5.3.2. It give me: PHP Catchable fatal error: Argument 1 passed to Sv\Controller\Index::index() must be an instance of Symfony\Component\HttpFoundation\Request, none given, called in /site/include/app/bootstrap.php on line 23 and defined in /site/include/app/Sv/Controller/Index.php on line 46 Here's my bootstrap PHP: ``` <?php require_once __DIR__ . '/../vendor/autoload.php'; use Sv\Repository\PostRepository; use Sv\Controller; $app = new Silex\Application(); // define global service for db access $app['posts.repository'] = $app->share( function () { return new Sv\Repository\PostRepository; }); // register controller as a service $app->register(new Silex\Provider\ServiceControllerServiceProvider()); $app['default.controller'] = $app->share(function () use ($app) { return new Controller\Index(); }); $app['service.controller'] = $app->share(function () use ($app) { return new Controller\Service($app['posts.repository']); }); // define routes $app->get('/', 'default.controller:index'); $app->get('/next', 'default.controller:next'); $service = $app['controllers_factory']; $service->get('/', "service.controller:indexJsonAction"); // mount routes $app->mount('/service', $service); // definitions $app->run(); ``` and here's the Controller code: ``` namespace Sv\Controller; use Silex\Application; use Symfony\Component\HttpFoundation\Request; class Index { public function index(Request $request, Application $app) { return 'Route /index reached'; } public function next(Request $request, Application $app) { return 'Route /next reached'; } } ``` Why does this not work? I hope this is not the same problem that prevents me from using ZF2 under PHP 5.3.2...