Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array and string offset access syntax with curly braces is deprecated in #878

Closed
NeftaliAcosta opened this issue Aug 31, 2020 · 1 comment

Comments

@NeftaliAcosta
Copy link

NeftaliAcosta commented Aug 31, 2020

I upgraded to php 7.4 and I get this issue. Help me please?

Deprecated: Array and string offset access syntax with curly braces is deprecated in C:\xampp\htdocs\proyecto\vendor\abraham\twitteroauth\src\SignatureMethod.php on line 61

image

/**
     * Verifies that a given signature is correct
     *
     * @param Request $request
     * @param Consumer $consumer
     * @param Token $token
     * @param string $signature
     *
     * @return bool
     */
    public function checkSignature(Request $request, Consumer $consumer, Token $token, $signature)
    {
        $built = $this->buildSignature($request, $consumer, $token);

        // Check for zero length, although unlikely here
        if (strlen($built) == 0 || strlen($signature) == 0) {
            return false;
        }

        if (strlen($built) != strlen($signature)) {
            return false;
        }

        // Avoid a timing leak with a (hopefully) time insensitive compare
        $result = 0;
        for ($i = 0; $i < strlen($signature); $i++) {
            $result |= ord($built{$i}) ^ ord($signature{$i});
        }

        return $result == 0;
    }
@abraham
Copy link
Owner

abraham commented Sep 2, 2020

This has been fixed in #788. Update to the latest version of TwitterOAuth.

@abraham abraham closed this as completed Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants