Skip to content

Commit

Permalink
fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Yves Maerschalck committed Mar 7, 2022
1 parent 69abb2b commit 7aae835
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
3 changes: 2 additions & 1 deletion src/OAuth/OAuthRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ public static function from_request($http_method = null, $http_url = null, $para
$scheme = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on")
? 'http'
: 'https';
$port = $scheme === 'https' ? '443' : '80';
$http_url = ($http_url) ? $http_url : $scheme .
'://' . $_SERVER['HTTP_HOST'] .
':' .
$_SERVER['SERVER_PORT'] .
$port .
$_SERVER['REQUEST_URI'];
$http_method = ($http_method) ? $http_method : $_SERVER['REQUEST_METHOD'];

Expand Down
2 changes: 1 addition & 1 deletion src/OAuth/OAuthSignatureMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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
18 changes: 9 additions & 9 deletions src/ToolProvider/DataConnector/DataConnector_pdo.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function loadToolConsumer($consumer)
}

if ($query->execute()) {
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
while ($row = $query->execute()->fetchAssociative()) {
$row = array_change_key_case($row);
if (empty($key256) || empty($row['consumer_key']) || ($consumer->getKey() === $row['consumer_key'])) {
$consumer->setRecordId(intval($row['consumer_pk']));
Expand Down Expand Up @@ -357,7 +357,7 @@ public function getToolConsumers()
}

if ($ok) {
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
while ($row = $query->execute()->fetchAssociative()) {
$row = array_change_key_case($row);
$key = empty($row['consumer_key']) ? $row['consumer_key256'] : $row['consumer_key'];
$consumer = new ToolProvider\ToolConsumer($key, $this);
Expand Down Expand Up @@ -464,7 +464,7 @@ public function loadContext($context)
}
$ok = $query->execute();
if ($ok) {
$row = $query->fetch(PDO::FETCH_ASSOC);
$row = $query->execute()->fetchAssociative();
$ok = ($row !== FALSE);
}
if ($ok) {
Expand Down Expand Up @@ -637,7 +637,7 @@ public function loadResourceLink($resourceLink)
}
$ok = $query->execute();
if ($ok) {
$row = $query->fetch(PDO::FETCH_ASSOC);
$row = $query->execute()->fetchAssociative();
$ok = ($row !== FALSE);
}

Expand Down Expand Up @@ -849,7 +849,7 @@ public function getUserResultSourcedIDsResourceLink($resourceLink, $localOnly, $
$query->bindValue('pid', $id, PDO::PARAM_INT);
}
if ($query->execute()) {
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
while ($row = $query->execute()->fetchAssociative()) {
$row = array_change_key_case($row);
$user = ToolProvider\User::fromRecordId($row['user_pk'], $resourceLink->getDataConnector());
if (is_null($idScope)) {
Expand Down Expand Up @@ -885,7 +885,7 @@ public function getSharesResourceLink($resourceLink)
$query = $this->db->prepare($sql);
$query->bindValue('id', $id, PDO::PARAM_INT);
if ($query->execute()) {
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
while ($row = $query->execute()->fetchAssociative()) {
$row = array_change_key_case($row);
$share = new ToolProvider\ResourceLinkShare();
$share->resourceLinkId = intval($row['resource_link_pk']);
Expand Down Expand Up @@ -931,7 +931,7 @@ public function loadConsumerNonce($nonce)
$query->bindValue('value', $value, PDO::PARAM_STR);
$ok = $query->execute();
if ($ok) {
$row = $query->fetch(PDO::FETCH_ASSOC);
$row = $query->execute()->fetchAssociative();
if ($row === false) {
$ok = false;
}
Expand Down Expand Up @@ -997,7 +997,7 @@ public function loadResourceLinkShareKey($shareKey)
$query = $this->db->prepare($sql);
$query->bindValue('id', $id, PDO::PARAM_STR);
if ($query->execute()) {
$row = $query->fetch(PDO::FETCH_ASSOC);
$row = $query->execute()->fetchAssociative();
if ($row !== FALSE) {
$row = array_change_key_case($row);
if (intval($row['resource_link_pk']) === $shareKey->resourceLinkId) {
Expand Down Expand Up @@ -1096,7 +1096,7 @@ public function loadUser($user)
$query->bindValue('uid', $uid, PDO::PARAM_STR);
}
if ($query->execute()) {
$row = $query->fetch(PDO::FETCH_ASSOC);
$row = $query->execute()->fetchAssociative();
if ($row !== false) {
$row = array_change_key_case($row);
$user->setRecordId(intval($row['user_pk']));
Expand Down

0 comments on commit 7aae835

Please sign in to comment.