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

Be more forgiving with error handlers that do not respect error suppression #5765

Closed
wants to merge 1 commit into from

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Mar 21, 2024

closes #5764

reproduced the reported problem locally with:

$ php ./phpunit tests/end-to-end/regression/5764/5764.phpt  --configuration tests/end-to-end/regression/5764/phpunit.xml 
PHPUnit 10.5.14-3-gadd7c75c3 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.2.12
Configuration: C:\dvl\Workspace\phpunit\tests\end-to-end\regression\5764\phpunit.xml



An error occurred inside PHPUnit.

Message:  file_get_contents(C:\dvl\Workspace\phpunit\tests\end-to-end\regression\5764\.phpunit.result.cache): Failed to open stream: No such file or directory
Location: C:\dvl\Workspace\phpunit\src\Runner\ResultCache\DefaultResultCache.php:88

#0 [internal function]: PHPUnit\TextUI\Application->{closure}()
#1 C:\dvl\Workspace\phpunit\src\Runner\ResultCache\DefaultResultCache.php(88): file_get_contents()
#2 C:\dvl\Workspace\phpunit\src\TextUI\TestRunner.php(40): PHPUnit\Runner\ResultCache\DefaultResultCache->load()
#3 C:\dvl\Workspace\phpunit\src\TextUI\Application.php(197): PHPUnit\TextUI\TestRunner->run()
#4 C:\dvl\Workspace\phpunit\phpunit(104): PHPUnit\TextUI\Application->run()
#5 {main}

@staabm staabm marked this pull request as ready for review March 21, 2024 16:01
@staabm
Copy link
Contributor Author

staabm commented Mar 21, 2024

I tried looking at 5ffcf34 to get an idea how to build the unit test. how to run the regression test locally?

@sebastianbergmann
Copy link
Owner

how to run the regression test locally?

Not sure I understand your question. You just want to run a single PHPT test? That would be ./phpunit /path/to/file.phpt.

@staabm
Copy link
Contributor Author

staabm commented Mar 21, 2024

hmm ok, I think this is a separate Problem :-)

$ php ./phpunit tests/end-to-end/regression/5764/5764.phpt  --configuration tests/end-to-end/regression/5764/phpunit.xml --do-not-cache-result --debug


An error occurred inside PHPUnit.

Message:  file_put_contents(): Exclusive locks are not supported for this stream
Location: C:\dvl\Workspace\phpunit\src\Logging\EventLogger.php:44

#0 [internal function]: PHPUnit\TextUI\Application->{closure}()
#1 C:\dvl\Workspace\phpunit\src\Logging\EventLogger.php(44): file_put_contents()
#2 C:\dvl\Workspace\phpunit\src\Event\Dispatcher\DirectDispatcher.php(88): PHPUnit\Logging\EventLogger->trace()
#3 C:\dvl\Workspace\phpunit\src\Event\Dispatcher\DeferringDispatcher.php(53): PHPUnit\Event\DirectDispatcher->dispatch()
#4 C:\dvl\Workspace\phpunit\src\Event\Facade.php(121): PHPUnit\Event\DeferringDispatcher->flush()
#5 C:\dvl\Workspace\phpunit\src\TextUI\Application.php(190): PHPUnit\Event\Facade->seal()
#6 C:\dvl\Workspace\phpunit\phpunit(104): PHPUnit\TextUI\Application->run()
#7 {main}

@staabm
Copy link
Contributor Author

staabm commented Mar 21, 2024

I reverted parts of the previous PR but left the safe optimizations in place

@staabm
Copy link
Contributor Author

staabm commented Mar 21, 2024

hmm ok, I think this is a separate Problem :-)

reported upstream in php/php-src#13777

Copy link

codecov bot commented Mar 22, 2024

Codecov Report

Attention: Patch coverage is 76.92308% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 90.09%. Comparing base (4cf8824) to head (93025fe).

Files Patch % Lines
src/Runner/PhptTestCase.php 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               10.5    #5765      +/-   ##
============================================
- Coverage     90.10%   90.09%   -0.01%     
- Complexity     6441     6445       +4     
============================================
  Files           680      680              
  Lines         19548    19554       +6     
============================================
+ Hits          17613    17617       +4     
- Misses         1935     1937       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sebastianbergmann sebastianbergmann changed the title Be more forgiving with error-handlers not respecting the @ operator Be more forgiving with error handlers that do not respect error suppression Mar 22, 2024
@sebastianbergmann
Copy link
Owner

Thank you.

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

Successfully merging this pull request may close these issues.

None yet

2 participants