From b498fdd24cf4941ecd5df8aa2052bf65292292ac Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Sun, 3 Feb 2019 19:43:33 +0100 Subject: [PATCH] Throw exception if allowSvgImage is called w/o imageOnly flag is set See #2825 --- .../lib/system/form/builder/field/UploadFormField.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wcfsetup/install/files/lib/system/form/builder/field/UploadFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/UploadFormField.class.php index 3c0dff9dae..4f30df8b93 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/UploadFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/UploadFormField.class.php @@ -242,8 +242,14 @@ class UploadFormField extends AbstractFormField { * * @param boolean $allowSvgImages * @return static this field + * + * @throws \BadMethodCallException if the imageOnly flag isn't set to true */ public function allowSvgImage($allowSvgImages = true) { + if (!$this->isImageOnly()) { + throw new \BadMethodCallException('Allowing SVG images is only relevant, if the `imageOnly` flag is set to `true`.'); + } + $this->allowSvgImage = $allowSvgImages; return $this; -- 2.20.1