-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Segmentation fault when running a PHPUnit test containing mocked object #12373
Comments
Infinite loop causing a stack overflow, this part repeats:
|
The reason it segfaults is because of infinite recursion, PHP 8.3 and up no longer segfault on this but throw an actual error. |
@nielsdos thank you for looking into this. Do you think this would need to be reported with PHPUnit as well? |
I'll have a deeper look into this this weekend, so maybe wait until we get results from that. :) |
I can confirm that this bug causing a "Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)" can be reproduced on: PHP 8.2.9 (cli) (built: Aug 16 2023 19:49:37) (NTS) I have sucesfully updated my system to: And this bug was gone. |
I am seeing this issue, PHPUnit exiting with code 139, running PHPUnit 10.5.16 using PHP 8.3.4 on Linux and PHP 8.3.0 on macOS The project is a Laravel 10.48.4 project, which has a ton of |
@matthewjumpsoffbuildings I am running on the same issue.
I am using the following version of PHP and Xdebug and I am getting that error since few days, on different projects. Did you maybe find any workaround?
|
Sadly no, I have no idea. The worst thing is it comes and goes, its very intermittent for me, failing at different steps, or sometimes ill get a few good runs and it will be fine |
Does it reproduce on PHP 8.3 for any of you? |
I have seen it in 8.1, 8.2, and 8.3 |
I've debugged this far enough now to be sure this is a phpunit bug. I'll be making a report at that repo soon with my findings. In short: this is an infinite recursion caused by phpunit mocking when it tries to match the return type. |
Opened sebastianbergmann/phpunit#5809, closing this now as invalid as it's not a PHP bug, and I'll monitor the PHPUnit issue. |
Description
Please see this repository on how to reproduce this issue: https://github.com/DragosMocrii/php-bug-destruct-segfault
The segmentation fault occurs when running a PHPUnit test containing a mocked object of a class containing a
__destruct
method, in which a public method with aself
return type is called.Issue is present with: PHP 8.2.10, PHP 8.1.23.
PHP Version
8.2.10
Operating System
Ubuntu 22.04
The text was updated successfully, but these errors were encountered: