Skip to content

Conversation

@nickvergessen
Copy link
Member

…s not string in validator"

Checklist

…s not string in validator"

This reverts commit fd156d3.

Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen nickvergessen added this to the Nextcloud 32 milestone Apr 9, 2025
@nickvergessen nickvergessen self-assigned this Apr 9, 2025
@nickvergessen nickvergessen requested a review from a team as a code owner April 9, 2025 06:46
@nickvergessen nickvergessen requested review from Altahrim, come-nc, provokateurin and skjnldsv and removed request for a team April 9, 2025 06:46
@provokateurin
Copy link
Member

But throwing the exception is breaking a lot of things as well. Can you just downgrade it to debug, so it no longer spams on production instances?

@nickvergessen
Copy link
Member Author

But throwing the exception is breaking a lot of things as well.

What is breaking, it is documented like that and 8 of 9 places calling the validation function catch the exception and change their behaviour based on it.

@susnux
Copy link
Contributor

susnux commented Apr 9, 2025

What is breaking, it is documented like that and 8 of 9 places calling the validation function catch the exception and change their behaviour based on it.

👍 why should the correct behavior here be changed just be cause of some edge cases of faulty apps not following the documentation? Better to fix it instead in the apps than accepting the error (which again can lead to unexpected errors)..

foreach ($parameter as $key => $value) {
if (!is_string($key)) {
Server::get(LoggerInterface::class)->error('Object for placeholder ' . $placeholder . ' is invalid, key ' . $key . ' is not a string');
throw new InvalidObjectExeption('Object for placeholder ' . $placeholder . ' is invalid, key ' . $key . ' is not a string');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we on line 59 add mire context to the exception?
E.g. log the subject? Otherwise finding the origin is quite hard.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notifications is handling this properly already, catching the exception and logging an app+subject message instead:

if (!$notification->isValidParsed()) {
$this->logger->info('Notification was not parsed by any notifier [app: ' . $notification->getApp() . ', subject: ' . $notification->getSubject() . ']');
throw new IncompleteParsedNotificationException();
}

Copy link
Member Author

@nickvergessen nickvergessen Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@provokateurin
Copy link
Member

👍 why should the correct behavior here be changed just be cause of some edge cases of faulty apps not following the documentation? Better to fix it instead in the apps than accepting the error (which again can lead to unexpected errors)..

The problem is mainly the activity app, because its entries are generated by other apps and it's near impossible to figure out where the source of the error is without checking literally every instance in the code. See #51427 for example.

@nickvergessen
Copy link
Member Author

Okay that should be covered by nextcloud/activity#1975 now

@nickvergessen nickvergessen requested a review from susnux April 9, 2025 07:36
@provokateurin provokateurin merged commit 3808f86 into master Apr 9, 2025
190 checks passed
@provokateurin provokateurin deleted the revert/52035 branch April 9, 2025 08:11
@nextcloud-bot nextcloud-bot mentioned this pull request Aug 19, 2025
@skjnldsv skjnldsv modified the milestones: Nextcloud 32, Nextcloud 33 Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants