Hi, I am currently developing a project on socket and I got simple warning that needed to be fixed. Though the problem is caused on my project related to socket but on further research, I found that it can be applicable on any problem that is found regarding the title.
Strict Standards: Only variables should be passed by reference in WebSocket.class.php on line 30
So, I took a look on each and every references but couldn’t find what exactly it is but tried some random things. My line of code where:
$changed = $this->sockets; socket_select($changed, $write=NULL, $except=NULL, NULL);
If you want the solution, the solution is:
$changed = $this->sockets; $write = NULL; $except = NULL; socket_select($changed, $write, $except, NULL);
The variable needs to be passed but I just passed the direct value to the function and it required variable which was not fixed. So, I just defined all the variables that might be needed and got the solution. If you got any problem with this, please first define the variable and pass it to the variable as the variable is sent as a pointer and needs to be changed by PHP function.
Same problem might occur on “end()” function so, you need to declare and $array = [“a”,”b”,”c”]; or explode(“.”,$fileName); and then pass it to the function as end($array).
Whew!!! Problem solved.