sveneld commented on code in PR #3796:
URL: https://github.com/apache/thrift/pull/3796#discussion_r3988003810
##########
lib/php/test/Unit/Lib/Transport/TSocketTest.php:
##########
@@ -469,6 +469,20 @@ public function testClose()
$this->assertNull($this->getPropertyValue($transport, 'handle'));
}
+ public function testClosePersistentSocket(): void
+ {
+ $transport = new TSocket('localhost', 9090, true, null);
+ $transport->setHandle(fopen('php://memory', 'r+'));
+
+ $this->assertNotNull($this->getPropertyValue($transport, 'handle'));
+
+ // Guard THRIFT-2151: close() must remain effective even when the
+ // socket was opened in persistent mode.
+ $transport->close();
+
+ $this->assertNull($this->getPropertyValue($transport, 'handle'));
Review Comment:
Addressed: retain the stream handle locally, assert it is a resource before
close(), and assertIsClosedResource() afterward, in addition to checking the
transport handle is null. The pfsockopen() path is already covered by
testOpenPersist(). Mutation check: temporarily skipping fclose() for persistent
sockets makes this regression test fail; the runtime implementation was
restored afterward. TSocketTest passes: 37 tests, 237 assertions; PHPCS passes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]