Skip to content

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

Closed
staabm wants to merge 1 commit intosebastianbergmann:10.5from
staabm:bug5764
Closed

Be more forgiving with error handlers that do not respect error suppression#5765
staabm wants to merge 1 commit intosebastianbergmann:10.5from
staabm:bug5764

Conversation

@staabm
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

staabm commented Mar 21, 2024

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

@staabm
Copy link
Copy Markdown
Contributor Author

staabm commented Mar 21, 2024

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

reported upstream in php/php-src#13777

@codecov
Copy link
Copy Markdown

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
Copy Markdown
Owner

Thank you.

@staabm staabm deleted the bug5764 branch March 22, 2024 05:50
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants