Skip to content

Commit 6ce5acf

Browse files
authored
Merge pull request #48 from pdsinterop/feature/php84
Feature/php84
2 parents 2f48942 + 9a655d4 commit 6ce5acf

File tree

4 files changed

+17
-19
lines changed

4 files changed

+17
-19
lines changed

src/Entity/Client.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class Client implements ClientEntityInterface
2020
* @param bool $isConfidential
2121
*/
2222
public function __construct(
23-
string $identifier = null,
24-
string $name = null,
25-
array $redirectUri = null,
23+
?string $identifier = null,
24+
?string $name = null,
25+
?array $redirectUri = null,
2626
bool $isConfidential = false
2727
) {
2828
$this->isConfidential = $isConfidential;

src/Server.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ final public function respondToDynamicClientRegistrationRequest(Request $request
5959

6060
final public function respondToAuthorizationRequest(
6161
Request $request,
62-
User $user = null,
63-
bool $authorizationApproved = null,
64-
callable $callback = null
62+
?User $user = null,
63+
?bool $authorizationApproved = null,
64+
?callable $callback = null
6565
) : Response {
6666
$serverConfig = $this->config->getServer();
6767
$authorizationServer = $this->authorizationServer;

src/TokenGenerator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ public function addIdTokenToResponse($response, $clientId, $subject, $nonce, $pr
190190
if (isset($body['error'])) {
191191
return $response;
192192
}
193-
194193
$accessToken = $this->generateAccessToken($clientId, $subject);
195194
$accessToken = $this->bindDpop($dpop, $accessToken);
196195
$accessToken = $this->signToken($accessToken);

src/WAC.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ public function isAllowed($request, $webId, $origin=false, $allowedOrigins=[]) {
5353
$uri = $request->getUri();
5454
$parentUri = $this->getParentUri($uri);
5555

56-
// @FIXME: $origin can be anything at this point, null, string, array, bool
57-
// This causes trouble downstream where an unchecked `parse_url($origin)['host'];` occurs
56+
// @FIXME: $origin can be anything at this point, null, string, array, bool
57+
// This causes trouble downstream where an unchecked `parse_url($origin)['host'];` occurs
5858

59-
foreach ($requestedGrants as $requestedGrant) {
59+
foreach ($requestedGrants as $requestedGrant) {
6060
switch ($requestedGrant['type']) {
6161
case "resource":
6262
if ($this->isPublicGranted($requestedGrant['grants'], $uri)) {
@@ -141,9 +141,9 @@ private function isOriginGranted($requestedGrants, $uri, $origin, $allowedOrigin
141141
) {
142142
return true;
143143
}
144-
//error_log("REQUESTED GRANT: " . join(" or ", $requestedGrants) . " on $uri");
144+
// error_log("REQUESTED GRANT: " . join(" or ", $requestedGrants) . " on $uri");
145145
$grants = $this->getOriginGrants($uri, $origin);
146-
//error_log("GRANTED GRANTS for origin $origin: " . json_encode($grants));
146+
// error_log("GRANTED GRANTS for origin $origin: " . json_encode($grants));
147147
return $this->checkGrants($requestedGrants, $uri, $grants);
148148
}
149149

@@ -307,14 +307,13 @@ private function getAclPath($path) {
307307

308308
foreach ($aclOptions as $aclPath) {
309309
if (
310-
$this->filesystem->has($aclPath)
311-
&& $this->filesystem->read($aclPath) !== false
310+
$this->filesystem->has($aclPath) && $this->filesystem->read($aclPath) !== false
312311
) {
313312
return $aclPath;
314313
}
315314
}
316315

317-
//error_log("Seeking .acl from $path");
316+
// error_log("Seeking .acl from $path");
318317
// see: https://github.com/solid/web-access-control-spec#acl-inheritance-algorithm
319318
// check for acl:default predicate, if not found, continue searching up the directory tree
320319
return $this->getParentAcl($path);
@@ -323,10 +322,10 @@ private function normalizePath($path) {
323322
return preg_replace("|//|", "/", $path);
324323
}
325324
private function getParentAcl($path) {
326-
//error_log("GET PARENT ACL $path");
327-
if ($this->filesystem->has($path.'/.acl')) {
328-
//error_log("CHECKING ACL FILE ON $path/.acl");
329-
return $path . "/.acl";
325+
// error_log("GET PARENT ACL $path");
326+
if ($this->filesystem->has($this->normalizePath($path.'/.acl'))) {
327+
// error_log("CHECKING ACL FILE ON $path/.acl");
328+
return $this->normalizePath($path . "/.acl");
330329
}
331330
$parent = dirname($path);
332331
if ($parent == $path) {

0 commit comments

Comments
 (0)