Skip to content
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

Change in symfony exception handler #711

Open
mmarton opened this issue Oct 28, 2024 · 5 comments
Open

Change in symfony exception handler #711

mmarton opened this issue Oct 28, 2024 · 5 comments

Comments

@mmarton
Copy link

mmarton commented Oct 28, 2024

Hi!

In yesterday releases (7.1.6, 6.4.13, 5.4.45) symfony fixed it's exception/error handler registration issue with phpunit.
see: symfony/symfony#58372

Now the workaround introduced after my previous issue (#640) is the one that triggers phpunit's THE ERROR HANDLER HAS CHANGED! warning :D

if I remove the call to KernelHelper::shutdownKernel the warning is gone.

env:
phpunit/phpunit                                11.4.2
symfony/framework-bundle                       7.1.6
zenstruck/foundry                              1.38.3
@nikophil
Copy link
Member

Hi @mmarton

would you mind to create a PR?

@lsv
Copy link

lsv commented Nov 14, 2024

What worked for me was just to empty the function restorePhpUnitErrorHandler in src/phpunit_helper.php

image

With the function intact

image

PHP 8.3
PHPUnit 11.4.3
Symfony 7.1
Foundry: v2.2.2

@kbond
Copy link
Member

kbond commented Nov 15, 2024

So we need to revert #643 and #642?

@nikophil
Copy link
Member

I think so, I just want to take a little bit more time to be sure that it works in every situation

@nikophil
Copy link
Member

nikophil commented Nov 22, 2024

When I remove the call to restorePhpUnitErrorHandler(), I got this warning in Foundry's testsuite

1) Zenstruck\Foundry\Tests\Integration\ArrayFactoryTest::can_create_with_defaults
Test code or tested code did not remove its own exception handlers

although it uses 7.1.6 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants