From b79cf81179b594491075187803443f7f343844d4 Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Sat, 13 Apr 2024 01:33:47 +0200 Subject: [PATCH] make sure that values like '0' are valid in select options --- classes/document.php-class | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/document.php-class b/classes/document.php-class index ebde6ec..c2f0fcf 100755 --- a/classes/document.php-class +++ b/classes/document.php-class @@ -687,10 +687,12 @@ class ExtendedDocument extends DOMDocument { public function createElementOption($key, $desc, $selected = false) { $option = $this->createElement('option', $desc); - if ($key) { + if (is_numeric($key) || is_string($key)) { $option->setAttribute('value', $key); } - if ($selected) { $option->setAttribute('selected', ''); } + if ($selected) { + $option->setAttribute('selected', ''); + } return $option; } -- 2.43.0