adoy / PHP-FastCGI-Client

Lightweight, single file, FastCGI client for PHP
MIT License
302 stars 61 forks source link

Support PHP 7.4 #21

Closed Sannis closed 4 years ago

Sannis commented 4 years ago

Curly brace syntax for accessing array elements and string offsets is deprecated in PHP 7.4.

This piece of code should be changed according to new rules:

        while ($p != $length) {
            $nlen = ord(
                $data {
                    $p++
                }
            );
            if ($nlen >= 128) {
                $nlen = ($nlen & 0x7F << 24);
                $nlen |= (ord(
                    $data {
                        $p++
                    }
                ) << 16);
                $nlen |= (ord(
                    $data {
                        $p++
                    }
                ) << 8);
                $nlen |= (ord(
                    $data {
                        $p++
                    }
                ));
            }
            $vlen = ord(
                $data {
                    $p++
                }
            );
            if ($vlen >= 128) {
                $vlen = ($nlen & 0x7F << 24);
                $vlen |= (ord(
                    $data {
                        $p++
                    }
                ) << 16);
                $vlen |= (ord(
                    $data {
                        $p++
                    }
                ) << 8);
                $vlen |= (ord(
                    $data {
                        $p++
                    }
                ));
            }
            $array[substr($data, $p, $nlen)] = substr($data, $p + $nlen, $vlen);
            $p += ($nlen + $vlen);
        }
adoy commented 4 years ago

Hi,

I'm going to release a new version soon.

adoy commented 4 years ago

Fixed in 1.0.2. Thanks :-)