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

[stable15] Validate all rich objects #12836

Merged
merged 2 commits into from
Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/Activity/Provider/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ protected function generateGroupParameter($gid) {
}

return [
'type' => 'group',
'type' => 'user-group',
'id' => $gid,
'name' => $this->groupDisplayNames[$gid],
];
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function dataGenerateGroupParameter() {
*/
public function testGenerateGroupParameter($gid) {
$this->assertEquals([
'type' => 'group',
'type' => 'user-group',
'id' => $gid,
'name' => $gid,
], $this->invokePrivate($this->provider, 'generateGroupParameter', [$gid]));
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/lib/Activity/Providers/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ protected function generateGroupParameter($gid) {
}

return [
'type' => 'group',
'type' => 'user-group',
'id' => $gid,
'name' => $this->groupDisplayNames[$gid],
];
Expand Down
10 changes: 8 additions & 2 deletions lib/private/RichObjectStrings/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,17 @@ public function validate($subject, array $parameters) {
foreach ($matches[1] as $parameter) {
if (!isset($parameters[$parameter])) {
throw new InvalidObjectExeption('Parameter is undefined');
} else {
$this->validateParameter($parameters[$parameter]);
}
}
}

foreach ($parameters as $parameter) {
if (!\is_array($parameter)) {
throw new InvalidObjectExeption('Parameter is malformed');
}

$this->validateParameter($parameter);
}
}

/**
Expand Down