Do not allow '0' as a value for width or height in QR code (#321)
This commit is contained in:
parent
28975d4625
commit
f68658d675
1 changed files with 6 additions and 2 deletions
|
@ -72,8 +72,12 @@ class element extends \mod_customcert\element {
|
|||
$errors = [];
|
||||
|
||||
// Check if height is not set, or not numeric or less than 0.
|
||||
if ((!isset($data['height'])) || (!is_numeric($data['height'])) || ($data['height'] < 0)) {
|
||||
$errors['height'] = get_string('invalidheight', 'customcertelement_qrcode');
|
||||
if ((!isset($data['height'])) || (!is_numeric($data['height'])) || ($data['height'] <= 0)) {
|
||||
$errors['height'] = get_string('invalidheight', 'mod_customcert');
|
||||
}
|
||||
|
||||
if ((!isset($data['width'])) || (!is_numeric($data['width'])) || ($data['width'] <= 0)) {
|
||||
$errors['width'] = get_string('invalidwidth', 'mod_customcert');
|
||||
}
|
||||
|
||||
if ($this->showposxy) {
|
||||
|
|
Loading…
Reference in a new issue