This repository was archived by the owner on Dec 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 501
This repository was archived by the owner on Dec 16, 2019. It is now read-only.
Lost resource. #930
Copy link
Copy link
Open
Description
Environment
- PHP: 7.2.2
- pthreads: 3.2.1dev
Summary
When assigning another object in the class constructor, the resource is lost.
Reproducing Code
$customSocket = new CustomSocket();
$exampleThread = new ExampleThread($customSocket);
class CustomSocket {
public $socket;
public function __construct()
{
$this->socket = socket_create(AF_UNIX, SOCK_STREAM, 0);
}
}
class ExampleThread extends Thread {
public $localCustomSocket;
public $localSocket;
public function __construct(CustomSocket $customSocket)
{
var_dump($customSocket);
$this->localCustomSocket = $customSocket;
var_dump($this->localCustomSocket);
$constructorCustomSocket = $customSocket;
var_dump($constructorCustomSocket);
$this->localSocket = $customSocket->socket;
var_dump($this->localSocket);
}
}
Expected Output
object(CustomSocket)#1 (1) {
["socket"]=>
resource(5) of type (Socket)
}
object(CustomSocket)#3 (1) {
["socket"]=>
resource(5) of type (Socket)
}
object(CustomSocket)#1 (1) {
["socket"]=>
resource(5) of type (Socket)
}
resource(5) of type (Socket)
Actual Output
object(CustomSocket)#1 (1) {
["socket"]=>
resource(5) of type (Socket)
}
object(CustomSocket)#3 (1) {
["socket"]=>
int(0)
}
object(CustomSocket)#1 (1) {
["socket"]=>
resource(5) of type (Socket)
}
resource(5) of type (Socket)
Metadata
Metadata
Assignees
Labels
No labels