Skip to content

Implement CaptainHook#256

Merged
GhaziTriki merged 2 commits into
bigbluebutton:developfrom
DigitalTimK:feature/captainHook
May 10, 2024
Merged

Implement CaptainHook#256
GhaziTriki merged 2 commits into
bigbluebutton:developfrom
DigitalTimK:feature/captainHook

Conversation

@DigitalTimK

@DigitalTimK DigitalTimK commented May 8, 2024

Copy link
Copy Markdown
Contributor

This PR will

Comment thread src/BigBlueButton.php Outdated
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-type: ' . $contentType,
'Content-length: ' . strlen($payload),
'Content-length: ' . mb_strlen($payload),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we will have to tackle this down once for all.
Can we get some inspiration from this repository https://github.com/kubawerlos/php-cs-fixer-custom-fixers and create a special custom fixer for this line?

It should be doable with something like this in the custom fixer class.

public function fix(\SplFileInfo $file, Tokens $tokens)
{
    // Replace the line 'Content-length: ' . strlen($payload), with 'Content-length: ' . mb_strlen($payload),
    foreach ($tokens as $index => $token) {
        if ($token->isGivenKind(T_CONSTANT_ENCAPSED_STRING) && $token->getContent() === "'Content-length: ' . strlen(\$payload),") {
            $tokens[$index] = new Token([T_CONSTANT_ENCAPSED_STRING, "'Content-length: ' . mb_strlen(\$payload),"]);
        }
    }
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@GhaziTriki GhaziTriki merged commit d87989a into bigbluebutton:develop May 10, 2024
@GhaziTriki GhaziTriki added this to the 3.0.0 milestone May 10, 2024
@DigitalTimK DigitalTimK deleted the feature/captainHook branch May 10, 2024 04:36
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

Successfully merging this pull request may close these issues.

2 participants