Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #33053 [ErrorHandler] Rework fatal errors (fancyweb)
This PR was merged into the 4.4 branch. Discussion ---------- [ErrorHandler] Rework fatal errors | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #32605 | License | MIT | Doc PR | - Built on top of #33038 so review only the second commit : d5c3f7e The goals of this PR is to replace current "fatal error handlers" with "error enhancers" since all our current fatal error handlers works on \Error since PHP7. That means we won't use the FatalErrorException anymore, so we will be able to remove it (once we don't need it in the rest of the codebase). The final goal btw is to handle \Throwable everywhere in the code so we can remove FatalThrowableError & FatalErrorException classes. Commits ------- aaa0cdf [ErrorHandler] Rework fatal error handlers
- Loading branch information
Showing
37 changed files
with
546 additions
and
632 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/Symfony/Component/ErrorHandler/Error/ClassNotFoundError.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\ErrorHandler\Error; | ||
|
||
class ClassNotFoundError extends \Error | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function __construct(string $message, \Throwable $previous) | ||
{ | ||
parent::__construct($message, $previous->getCode(), $previous->getPrevious()); | ||
|
||
foreach ([ | ||
'file' => $previous->getFile(), | ||
'line' => $previous->getLine(), | ||
'trace' => $previous->getTrace(), | ||
] as $property => $value) { | ||
$refl = new \ReflectionProperty(\Error::class, $property); | ||
$refl->setAccessible(true); | ||
$refl->setValue($this, $value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/Symfony/Component/ErrorHandler/Error/UndefinedFunctionError.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\ErrorHandler\Error; | ||
|
||
class UndefinedFunctionError extends \Error | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function __construct(string $message, \Throwable $previous) | ||
{ | ||
parent::__construct($message, $previous->getCode(), $previous->getPrevious()); | ||
|
||
foreach ([ | ||
'file' => $previous->getFile(), | ||
'line' => $previous->getLine(), | ||
'trace' => $previous->getTrace(), | ||
] as $property => $value) { | ||
$refl = new \ReflectionProperty(\Error::class, $property); | ||
$refl->setAccessible(true); | ||
$refl->setValue($this, $value); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/Symfony/Component/ErrorHandler/Error/UndefinedMethodError.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\ErrorHandler\Error; | ||
|
||
class UndefinedMethodError extends \Error | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function __construct(string $message, \Throwable $previous) | ||
{ | ||
parent::__construct($message, $previous->getCode(), $previous->getPrevious()); | ||
|
||
foreach ([ | ||
'file' => $previous->getFile(), | ||
'line' => $previous->getLine(), | ||
'trace' => $previous->getTrace(), | ||
] as $property => $value) { | ||
$refl = new \ReflectionProperty(\Error::class, $property); | ||
$refl->setAccessible(true); | ||
$refl->setValue($this, $value); | ||
} | ||
} | ||
} |
Oops, something went wrong.