Commit 5d5046e9 authored by Fabien Potencier's avatar Fabien Potencier

feature #1142 fixed compatibility with 2.7 (fabpot)

This PR was merged into the 1.3 branch.

Discussion
----------

fixed compatibility with 2.7

replaces #1141

Note that 2.7 beta1 won't work because symfony/symfony#14313 was merged after the release.

Commits
-------

426cde53 fixed compatibility with 2.7
parents 5f661aa1 426cde53
...@@ -4,6 +4,7 @@ Changelog ...@@ -4,6 +4,7 @@ Changelog
1.3.0 (2015-XX-XX) 1.3.0 (2015-XX-XX)
------------------ ------------------
* deprecated `$app['exception_handler']->disable()` in favor of `unset($app['exception_handler'])`
* made Silex compatible with Symfony 2.7 (and keep compatibility with Symfony 2.3, 2.5, and 2.6) * made Silex compatible with Symfony 2.7 (and keep compatibility with Symfony 2.3, 2.5, and 2.6)
* removed deprecated TwigCoreExtension class (register the new HttpFragmentServiceProvider instead) * removed deprecated TwigCoreExtension class (register the new HttpFragmentServiceProvider instead)
* bumped minimum version of PHP to 5.3.9 * bumped minimum version of PHP to 5.3.9
......
...@@ -221,9 +221,9 @@ don't want to mess with most of them. ...@@ -221,9 +221,9 @@ don't want to mess with most of them.
the request that is used by the Router and the UrlGenerator. the request that is used by the Router and the UrlGenerator.
* **exception_handler**: The Exception handler is the default handler that is * **exception_handler**: The Exception handler is the default handler that is
used when you don't register one via the ``error()`` method or if your handler used when you don't register one via the ``error()`` method or if your
does not return a Response. Disable it with handler does not return a Response. Disable it with
``$app['exception_handler']->disable()``. ``unset($app['exception_handler'])``.
* **logger**: A ``Psr\Log\LoggerInterface`` instance. By default, logging is * **logger**: A ``Psr\Log\LoggerInterface`` instance. By default, logging is
disabled as the value is set to ``null``. To enable logging you can either use disabled as the value is set to ``null``. To enable logging you can either use
......
...@@ -108,7 +108,7 @@ executed before every test. ...@@ -108,7 +108,7 @@ executed before every test.
{ {
$app = require __DIR__.'/path/to/app.php'; $app = require __DIR__.'/path/to/app.php';
$app['debug'] = true; $app['debug'] = true;
$app['exception_handler']->disable(); unset($app['exception_handler']);
return $app; return $app;
} }
......
...@@ -32,6 +32,9 @@ class ExceptionHandler implements EventSubscriberInterface ...@@ -32,6 +32,9 @@ class ExceptionHandler implements EventSubscriberInterface
$this->enabled = true; $this->enabled = true;
} }
/**
* @deprecated since 1.3, to be removed in 2.0
*/
public function disable() public function disable()
{ {
$this->enabled = false; $this->enabled = false;
......
...@@ -525,7 +525,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase ...@@ -525,7 +525,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
public function testGetRouteCollectionWithRouteWithoutController() public function testGetRouteCollectionWithRouteWithoutController()
{ {
$app = new Application(); $app = new Application();
$app['exception_handler']->disable(); unset($app['exception_handler']);
$app->match('/')->bind('homepage'); $app->match('/')->bind('homepage');
$app->handle(Request::create('/')); $app->handle(Request::create('/'));
} }
......
...@@ -107,7 +107,7 @@ class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase ...@@ -107,7 +107,7 @@ class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase
public function testNoExceptionHandler() public function testNoExceptionHandler()
{ {
$app = new Application(); $app = new Application();
$app['exception_handler']->disable(); unset($app['exception_handler']);
$app->match('/foo', function () { $app->match('/foo', function () {
throw new \RuntimeException('foo exception'); throw new \RuntimeException('foo exception');
...@@ -207,6 +207,8 @@ class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase ...@@ -207,6 +207,8 @@ class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase
$this->fail('->handle() should not catch exceptions where an empty error handler was supplied'); $this->fail('->handle() should not catch exceptions where an empty error handler was supplied');
} catch (\RuntimeException $e) { } catch (\RuntimeException $e) {
$this->assertEquals('foo exception', $e->getMessage()); $this->assertEquals('foo exception', $e->getMessage());
} catch (\LogicException $e) {
$this->assertEquals('foo exception', $e->getPrevious()->getMessage());
} }
$this->assertEquals(1, $errors, 'should execute the error handler'); $this->assertEquals(1, $errors, 'should execute the error handler');
...@@ -261,7 +263,7 @@ class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase ...@@ -261,7 +263,7 @@ class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase
// just making sure the dispatcher gets created // just making sure the dispatcher gets created
}); });
$app['exception_handler']->disable(); unset($app['exception_handler']);
try { try {
$request = Request::create('/foo'); $request = Request::create('/foo');
......
...@@ -63,7 +63,7 @@ class RememberMeServiceProviderTest extends WebTestCase ...@@ -63,7 +63,7 @@ class RememberMeServiceProviderTest extends WebTestCase
$app = new Application(); $app = new Application();
$app['debug'] = true; $app['debug'] = true;
$app['exception_handler']->disable(); unset($app['exception_handler']);
$app->register(new SessionServiceProvider(), array( $app->register(new SessionServiceProvider(), array(
'session.test' => true, 'session.test' => true,
......
...@@ -94,7 +94,7 @@ class SessionServiceProviderTest extends WebTestCase ...@@ -94,7 +94,7 @@ class SessionServiceProviderTest extends WebTestCase
}); });
$app['debug'] = true; $app['debug'] = true;
$app['exception_handler']->disable(); unset($app['exception_handler']);
$client = new Client($app); $client = new Client($app);
......
...@@ -100,7 +100,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase ...@@ -100,7 +100,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
public function testMissingRoute() public function testMissingRoute()
{ {
$app = new Application(); $app = new Application();
$app['exception_handler']->disable(); unset($app['exception_handler']);
$request = Request::create('/baz'); $request = Request::create('/baz');
$app->handle($request); $app->handle($request);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment