Usage of SessionHandlerInterface breaks compatibility with PHP <5.4
Hello,
I'm currently using php 5.3.8 (on windows) and updated Silex and its Symfony components yesterday (2012/06/02).
After trying to use Symfony's session handler by including this line : $app->register(new Silex\Provider\SessionServiceProvider);
I got an error that ressembles this : "Fatal error: Interface 'SessionHandlerInterface' not found in [...]\Symfony\Component\HttpFoundation\Session\Storage\Handler\FileSessionHandler.php on line 20".
After checking on PHP's site, I noticed the SessionHandlerInterface class is available for v5.4.0 and above only. Does that mean that Silex and Symfony's session component are no longer compatible with php 5.3.3? Or is there a way to circumvent this, by using a previous version of the HttpFoundation component?
Shaun
HttpFoundation has a fallback implementation for PHP 5.3 in Symfony/Component/HttpFoundation/Resources/stubs which should actually get autoloaded by composer.
Are you using composer to manage your dependencies?
Oh, no I don't use composer. I naively thought that including the components as they were, directly from the downloaded sources would work as is.
I'll look into that, thanks. Next time I'll check before asking...
The downloaded sources being the zip file from silex.sensiolabs.org? If so, make sure you also update vendor/autoload*.php.
Yes, I'm using the zip file from the official site. Up until yesterday, my project was using an old version of silex/symfony components (back from when the phar file was used) so I'll need to update it accordingly, with the correct autoload system and perhaps use composer as well.
Thanks for your help!
You can add this in your autoload.php file
$loader->registerPrefixFallbacks(array( DIR.'/../../vendor/symfony/src/Symfony/Component/HttpFoundation/Resources/stubs', ));