-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Debug exception classes fail to pass $previous to FatalErrorException #27483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you create a small example application that allows to reproduce your issue? |
I was hoping it'd be obvious enough that Below is an example controller that contains routes that trigger an error in each one of the classes: <?php
namespace App\Controller;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class BugController extends Controller
{
/**
* @Route("/bug/method")
*/
public function me()
{
try {
throw new \RuntimeException("This exception doesn't matter much");
} finally {
$a = new \stdClass();
$a->undefinedMethod();
}
}
/**
* @Route("/bug/function")
*/
public function fu()
{
try {
throw new \RuntimeException("This exception doesn't matter much");
} finally {
undefined_function();
}
}
/**
* @Route("/bug/class")
*/
public function cl()
{
try {
throw new \RuntimeException("This exception doesn't matter much");
} finally {
$a = new UndefinedClass();
}
}
} |
Can I take this one? |
My suggestion
Is it ok for you? |
@pmontoya Sounds reasonable to me, would you like to create a PR? |
@xabbuh : The bug exists in 2.8 but type hint error in 4.0. On which branch I create the fix please? |
…ontoya) This PR was merged into the 2.8 branch. Discussion ---------- [Debug] Pass previous exception to FatalErrorException | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #27483 | License | MIT Add a previous parameter to FatalErrorException. Call \ErrorException with this parameter. Update parent::__constructor for inherited classes with default parameters and the new one Commits ------- 7f9780b Pass previous exception to FatalErrorException
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected: 4.1.2 (appears to affect 4.1.0)
Description
Debug exceptions pass an invalid parameter when
$previous
is set. e.g:Classes that appear to be affected:
ClassNotFoundException
UndefinedFunctionException
UndefinedMethodException
How to reproduce
Trigger an undefined method, class, or function with another exception.
Possible Solution
$previous
to theFatalErrorException
constructor (potentially use a setter?)The text was updated successfully, but these errors were encountered: