Improved behavior for missing comment approval permission
authorAlexander Ebert <ebert@woltlab.com>
Mon, 3 Jul 2017 12:21:48 +0000 (14:21 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 3 Jul 2017 12:21:55 +0000 (14:21 +0200)
wcfsetup/install/files/lib/system/comment/manager/AbstractCommentManager.class.php

index 7a8e7c9bca6cc98a03328d8f94244f42a223711a..7c9a3c98caa08bfce23b5c84a2989718e7ab9b65 100644 (file)
@@ -86,7 +86,12 @@ abstract class AbstractCommentManager extends SingletonFactory implements IComme
                }
                
                if (empty($this->permissionAddWithoutModeration)) {
-                       return false;
+                       if (ENABLE_DEBUG_MODE) {
+                               throw new \RuntimeException("Missing permission name to create comments without approval.");
+                       }
+                       
+                       // backwards-compatibility in production mode
+                       return true;
                }
                
                return (WCF::getSession()->getPermission($this->permissionAddWithoutModeration) ? true : false);