paragi / PHP-websocket-client

142 stars 60 forks source link

[Bug] stripos instead of strpos and resolve compare #4

Closed NabiKAZ closed 4 years ago

NabiKAZ commented 4 years ago

1) Must used === false instead of ! for strpos.

Warning: This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. ref

2) I've seen it sometimes return sec-websocket-accept so must be used stripos instead of strpos for case-insensitive

https://github.com/paragi/PHP-websocket-client/blob/cefdf416d96d01733bd6e62b9ba0ddbbe5888e96/websocket_client.php#L117

NabiKAZ commented 4 years ago

I created a PR https://github.com/paragi/PHP-websocket-client/pull/5