Skip to content

Commit 008f29a

Browse files
committed
Fix "spl_object_id() expects parameter 1 to be object, resource given"
1 parent a91eec9 commit 008f29a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/wp-mysql-proxy/src/class-mysql-proxy.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function start() {
4040
if ( $client ) {
4141
echo "New client connected.\n";
4242
$this->clients[] = $client;
43-
$client_id = spl_object_id( $client );
43+
$client_id = get_resource_id( $client );
4444
$this->client_servers[ $client_id ] = new MySQL_Session( $this->query_handler );
4545

4646
// Send initial handshake
@@ -75,7 +75,7 @@ public function start() {
7575
if ( false === $data || '' === $data ) {
7676
// Client disconnected
7777
echo "Client disconnected.\n";
78-
$client_id = spl_object_id( $client );
78+
$client_id = get_resource_id( $client );
7979
$this->client_servers[ $client_id ]->reset();
8080
unset( $this->client_servers[ $client_id ] );
8181
socket_close( $client );
@@ -85,7 +85,7 @@ public function start() {
8585

8686
try {
8787
// Process the data
88-
$client_id = spl_object_id( $client );
88+
$client_id = get_resource_id( $client );
8989
echo "Receiving bytes\n";
9090
$response = $this->client_servers[ $client_id ]->receive_bytes( $data );
9191
if ( $response ) {

0 commit comments

Comments
 (0)