varspool / Wrench

A simple PHP WebSocket implementation for PHP 7.1
Do What The F*ck You Want To Public License
596 stars 210 forks source link

Potential bug in protocol processing edge case #88

Closed jessecrossen closed 7 years ago

jessecrossen commented 8 years ago

The behavior of this line does not seem to match the intent: https://github.com/varspool/Wrench/blob/master/lib/Wrench/Protocol/Protocol.php#L696

It currently reads:

        if (count($parts) != 2) {
            $parts = array($parts, '');
        }

I think what you want to do is this:

        if (count($parts) != 2) {
            $parts = array($parts[0], '');
        }

Otherwise you wind up with nested arrays, which will break the explode call below.