8000 feature #15422 [Debug] Remove deprecated ExceptionHandler::createResp… · symfony/symfony@c73e0a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit c73e0a3

Browse files
committed
feature #15422 [Debug] Remove deprecated ExceptionHandler::createResponse (nicolas-grekas)
This PR was merged into the 3.0-dev branch. Discussion ---------- [Debug] Remove deprecated ExceptionHandler::createResponse | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- df4e983 [Debug] Remove deprecated ExceptionHandler::createResponse
2 parents c309289 + df4e983 commit c73e0a3

File tree

1 file changed

+2
-50
lines changed

1 file changed

+2
-50
lines changed

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)
0