Uh oh!
There was an error while loading. Please reload this page.
Revert "refactor(RichObjectStrings): Only log error if key or value i… - #52062
Conversation
…s not string in validator" This reverts commit fd156d3. Signed-off-by: Joas Schilling <coding@schilljs.com>
provokateurin
commented
Apr 9, 2025
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
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. |
susnux
commented
Apr 9, 2025
👍 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'); |
There was a problem hiding this comment.
Can we on line 59 add mire context to the exception?
E.g. log the subject? Otherwise finding the origin is quite hard.
There was a problem hiding this comment.
Notifications is handling this properly already, catching the exception and logging an app+subject message instead:
server/lib/private/Notification/Manager.php
Lines 366 to 369 in ed6d76e
There was a problem hiding this comment.
- Improved the handling in the activity app the same way fix: Improving logging of invalid parameters for activity subject and… activity#1975
provokateurin
commented
Apr 9, 2025
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
commented
Apr 9, 2025
Okay that should be covered by nextcloud/activity#1975 now |
…s not string in validator"
Checklist