diff options
author | Kate <26026535+provokateurin@users.noreply.github.com> | 2024-09-10 17:40:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-10 17:40:46 +0200 |
commit | 979cc8712cfe090d01508a8cd56eca04e2d9f1c8 (patch) | |
tree | 4ea36bdee4428e768a5b3fbbbd36a35561298156 /lib | |
parent | a7eaed721c477230176b0689cfcc2c1c7b458ec3 (diff) | |
parent | a3da7456a7b4872cf788b6d853e792d83af7b505 (diff) | |
download | nextcloud-server-979cc8712cfe090d01508a8cd56eca04e2d9f1c8.tar.gz nextcloud-server-979cc8712cfe090d01508a8cd56eca04e2d9f1c8.zip |
Merge pull request #47662 from nextcloud/fix/notification/validate-rich-object-key-value-types
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Activity/Event.php | 4 | ||||
-rw-r--r-- | lib/private/RichObjectStrings/Validator.php | 9 | ||||
-rw-r--r-- | lib/public/Activity/IEvent.php | 8 | ||||
-rw-r--r-- | lib/public/Notification/INotification.php | 4 | ||||
-rw-r--r-- | lib/public/SetupCheck/SetupResult.php | 1 |
5 files changed, 18 insertions, 8 deletions
diff --git a/lib/private/Activity/Event.php b/lib/private/Activity/Event.php index 97ab7d1c935..02cfd758058 100644 --- a/lib/private/Activity/Event.php +++ b/lib/private/Activity/Event.php @@ -259,7 +259,7 @@ class Event implements IEvent { } /** - * @return array[] + * @return array<string, array<string, string>> * @since 11.0.0 */ public function getRichSubjectParameters(): array { @@ -335,7 +335,7 @@ class Event implements IEvent { } /** - * @return array[] + * @return array<string, array<string, string>> * @since 11.0.0 */ public function getRichMessageParameters(): array { diff --git a/lib/private/RichObjectStrings/Validator.php b/lib/private/RichObjectStrings/Validator.php index 41c2456ba27..197f48ed48c 100644 --- a/lib/private/RichObjectStrings/Validator.php +++ b/lib/private/RichObjectStrings/Validator.php @@ -78,6 +78,15 @@ class Validator implements IValidator { if (!empty($missingKeys)) { throw new InvalidObjectExeption('Object is invalid, missing keys:'.json_encode($missingKeys)); } + + foreach ($parameter as $key => $value) { + if (!is_string($key)) { + throw new InvalidObjectExeption('Object is invalid, key ' . $key . ' is not a string'); + } + if (!is_string($value)) { + throw new InvalidObjectExeption('Object is invalid, value ' . $value . ' is not a string'); + } + } } /** diff --git a/lib/public/Activity/IEvent.php b/lib/public/Activity/IEvent.php index f204de599b9..eba426c5ecf 100644 --- a/lib/public/Activity/IEvent.php +++ b/lib/public/Activity/IEvent.php @@ -121,7 +121,7 @@ interface IEvent { * See https://github.com/nextcloud/server/issues/1706 for more information. * * @param string $subject - * @param array $parameters + * @param array<string, array<string, string>> $parameters * @return $this * @throws InvalidValueException if the subject or parameters are invalid * @since 11.0.0 @@ -136,7 +136,7 @@ interface IEvent { public function getRichSubject(): string; /** - * @return array[] + * @return array<string, array<string, string>> * @since 11.0.0 */ public function getRichSubjectParameters(): array; @@ -187,7 +187,7 @@ interface IEvent { * See https://github.com/nextcloud/server/issues/1706 for more information. * * @param string $message - * @param array $parameters + * @param array<string, array<string, string>> $parameters * @return $this * @throws \InvalidArgumentException if the message or parameters are invalid * @since 11.0.0 @@ -202,7 +202,7 @@ interface IEvent { public function getRichMessage(): string; /** - * @return array[] + * @return array<string, array<string, string>> * @since 11.0.0 */ public function getRichMessageParameters(): array; diff --git a/lib/public/Notification/INotification.php b/lib/public/Notification/INotification.php index 28d2d6bff5a..4a35ee59087 100644 --- a/lib/public/Notification/INotification.php +++ b/lib/public/Notification/INotification.php @@ -137,7 +137,7 @@ interface INotification { * See https://github.com/nextcloud/server/issues/1706 for more information. * * @param string $subject - * @param array $parameters + * @param array<string, array<string, string>> $parameters * @return $this * @throws InvalidValueException if the subject or parameters are invalid * @since 11.0.0 @@ -213,7 +213,7 @@ interface INotification { * See https://github.com/nextcloud/server/issues/1706 for more information. * * @param string $message - * @param array $parameters + * @param array<string, array<string, string>> $parameters * @return $this * @throws InvalidValueException if the message or parameters are invalid * @since 11.0.0 diff --git a/lib/public/SetupCheck/SetupResult.php b/lib/public/SetupCheck/SetupResult.php index c79c4e762da..7d64b838087 100644 --- a/lib/public/SetupCheck/SetupResult.php +++ b/lib/public/SetupCheck/SetupResult.php @@ -45,6 +45,7 @@ class SetupResult implements \JsonSerializable { /** * @brief Private constructor, use success()/info()/warning()/error() instead * @param self::SUCCESS|self::INFO|self::WARNING|self::ERROR $severity + * @param array<string, array<string, string>> $descriptionParameters * @throws \OCP\RichObjectStrings\InvalidObjectExeption * @since 28.0.0 * @since 28.0.2 Optional parameter ?array $descriptionParameters |