Closed cgimenes closed 7 months ago
What do you think of? https://github.com/donatj/mock-webserver/pull/68
Can you provide a code example of how to trigger the issue?
Just to be clear. I was using 2.6.1 and after upgrading to 2.7.1 I started getting TypeError : fclose(): supplied resource is not a valid stream resource
when calling MockWebServer->stop()
I can't come up with any way that that a descriptor should be in that array and an open valid stream resource.
Are you using any sort of test parallelizers or such?
Yes, I'm using. But, I think I may found out why I'm the only one having this issue. I'm calling stop()
twice.
<?php
declare(strict_types=1);
use donatj\MockWebServer\MockWebServer;
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{
public function setUp(): void
{
$this->server = new MockWebServer();
$this->server->start();
}
public function tearDown(): void
{
$this->server->stop();
$this->server->stop();
}
public function testValid(): void
{
self::assertTrue(true);
}
}
You know, that's the one thing I didn't think of. That would do it. I will fix that!
Published a release with a fix and a regression test ;)
Thanks for the report!
https://github.com/donatj/mock-webserver/releases/tag/v2.7.2
Thank you!
I don't think
@fclose($descriptor);
atsrc/MockWebServer.php#L135
is working. Maybe wrap in an empty try/catch?