Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0254143

Browse files
[Debug] Remove deprecated ExceptionHandler::createResponse
1 parent dda085e commit 0254143

File tree

2 files changed

+17
-50
lines changed

2 files changed

+17
-50
lines changed

UPGRADE-3.0.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,3 +1259,18 @@ UPGRADE FROM 2.x to 3.0
12591259
### HttpFoundation
12601260

12611261
* `Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface` no longer implements the `IteratorAggregate` interface. Use the `all()` method instead of iterating over the flash bag.
1262+
1263+
### Debug
1264+
1265+
* `DebugClassLoader::__construct()` now accepts only a `callable` argument.
1266+
* `DebugClassLoader::getClassLoader()` now always returns `callable`.
1267+
* `DebugClassLoader::findFile()` has been removed.
1268+
* `ErrorHandler::TYPE_DEPRECATION` has been removed.
1269+
* `ErrorHandler::setLevel()` has been removed, use throwAt() instead.
1270+
* `ErrorHandler::setDisplayErrors()` has been removed, use throwAt() instead.
1271+
* `ErrorHandler::setLogger()` has been removed, use setLoggers() or setDefaultLogger() instead.
1272+
* `ErrorHandler::handle()` has been removed, use handleError() instead.
1273+
* `ErrorHandler::handleFatal()` has been removed, use handleFatalError() instead.
1274+
* `ExceptionHandler::createException()` has been removed.
1275+
* `ExceptionHandler::utf8Htmlize()` has been removed.
1276+
* `Exception/DummyException` has been removed.

src/Symfony/Component/Debug/ExceptionHandler.php

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function setFileLinkFormat($format)
115115
public function handle(\Exception $exception)
116116
{
117117
if (null === $this->handler || $exception instanceof OutOfMemoryException) {
118-
$this->failSafeHandle($exception);
118+
$this->sendPhpResponse($exception);
119119

120120
return;
121121
}
@@ -128,8 +128,7 @@ public function handle(\Exception $exception)
128128
return '';
129129
});
130130

131-
132-
$this->failSafeHandle($exception);
131+
$this->sendPhpResponse($exception);
133132
while (null === $this->caughtBuffer && ob_end_flush()) {
134133
// Empty loop, everything is in the condition
135134
}
@@ -162,33 +161,6 @@ public function handle(\Exception $exception)
162161
}
163162
}
164163

165-
/**
166-
* Sends a response for the given Exception.
167-
*
168-
* If you have the Symfony HttpFoundation component installed,
169-
* this method will use it to create and send the response. If not,
170-
* it will fallback to plain PHP functions.
171-
*
172-
* @param \Exception $exception An \Exception instance
173-
*/
174-
private function failSafeHandle(\Exception $exception)
175-
{
176-
if (class_exists('Symfony\Component\HttpFoundation\Response', false)
177-
&& __CLASS__ !== get_class($this)
178-
&& ($reflector = new \ReflectionMethod($this, 'createResponse'))
179-
&& __CLASS__ !== $reflector->class
180-
) {
181-
$response = $this->createResponse($exception);
182-
$response->sendHeaders();
183-
$response->sendContent();
184-
@trigger_error(sprintf("The %s::createResponse method is deprecated since 2.8 and won't be called anymore when handling an exception in 3.0.", $reflector->class), E_USER_DEPRECATED);
185-
186-
return;
187-
}
188-
189-
$this->sendPhpResponse($exception);
190-
}
191-
192164
/**
193165
* Sends the error associated with the given Exception as a plain PHP response.
194166
*
@@ -214,26 +186,6 @@ public function sendPhpResponse($exception)
214186
echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
215187
}
216188

217-
/**
218-
* Creates the error Response associated with the given Exception.
219-
*
220-
* @param \Exception|FlattenException $exception An \Exception instance
221-
*
222-
* @return Response A Response instance
223-
*
224-
* @deprecated since 2.8, to be removed in 3.0.
225-
*/
226-
public function createResponse($exception)
227-
{
228-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
229-
230-
if (!$exception instanceof FlattenException) {
231-
$exception = FlattenException::create($exception);
232-
}
233-
234-
return Response::create($this->decorate($this->getContent($exception), $this->getStylesheet($exception)), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
235-
}
236-
237189
/**
238190
* Gets the HTML content associated with the given exception.
239191
*

0 commit comments

Comments
 (0)