spidEY
spidEY

Reputation: 944

Only variables should be passed by reference - socket_select()

I have a function in my class which utilizes the socket_select() function and I noticed that it's throwing this warning:

Strict Standards: *Only variables should be passed by reference*

This is how I'm using it, and yes, I did read the "Example #1 Using NULL with socket_select()" in the PHP Manual

$read = array($this->socket);
$write = NULL;
$except = NULL;

socket_select($read, $write, $except, 0, $this->socket_timeout);

This results in a big error spam when calling the function inside a while loop. Of course, I can suppress the E_STRICT errors, but I would like to know what's the exact issue here. My PHP version is 5.3.5

Upvotes: 7

Views: 3487

Answers (2)

Vyacheslav Shmal
Vyacheslav Shmal

Reputation: 136

I solved it with assigning the variable earlier with this data $null=null; and using after that inside the socket_select($read, $null, $null, $tv_sec = 5)

Upvotes: 0

BadPenguin
BadPenguin

Reputation: 21

Possibly it doesn't like a NULL reference?

I would try:

$read = array($this->socket);
$write = array();
$except = array();

Upvotes: 1

Related Questions