Skip to content

Commit

Permalink
fix for php 8
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzmind authored Jan 4, 2024
1 parent a35cbfc commit 5f737f4
Show file tree
Hide file tree
Showing 2 changed files with 246 additions and 157 deletions.
6 changes: 3 additions & 3 deletions Vendor/OAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function check_signature($request, $consumer, $token, $signature) {
// 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});
$result |= ord($built[$i]) ^ ord($signature[$i]);
}

return $result == 0;
Expand Down Expand Up @@ -202,6 +202,7 @@ public function build_signature($request, $consumer, $token) {

// Pull the private key ID from the certificate
$privatekeyid = openssl_get_privatekey($cert);
$signature = "";

// Sign using the key
$ok = openssl_sign($base_string, $signature, $privatekeyid);
Expand Down Expand Up @@ -773,6 +774,7 @@ public static function urldecode_rfc3986($string) {
// see http://code.google.com/p/oauth/issues/detail?id=163
public static function split_header($header, $only_allow_oauth_parameters = true) {
$params = array();
$matches = [];
if (preg_match_all('/('.($only_allow_oauth_parameters ? 'oauth_' : '').'[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', $header, $matches)) {
foreach ($matches[1] as $i => $h) {
$params[$h] = OAuthUtil::urldecode_rfc3986(empty($matches[3][$i]) ? $matches[4][$i] : $matches[3][$i]);
Expand Down Expand Up @@ -893,5 +895,3 @@ public static function build_http_query($params) {
return implode('&', $pairs);
}
}

?>
Loading

0 comments on commit 5f737f4

Please sign in to comment.