From c3b9c72df91bc901ab1a02d618a056a994eaf220 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Tue, 14 Feb 2023 09:28:03 -0500 Subject: [PATCH] Additional updates for processwire/processwire-issues#1467 --- wire/core/WireDatabasePDO.php | 2 +- wire/core/WireInput.php | 1 + wire/modules/Inputfield/InputfieldInteger.module | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/wire/core/WireDatabasePDO.php b/wire/core/WireDatabasePDO.php index 0664debe..a44e18e3 100644 --- a/wire/core/WireDatabasePDO.php +++ b/wire/core/WireDatabasePDO.php @@ -1561,7 +1561,7 @@ class WireDatabasePDO extends Wire implements WireDatabase { if($this->stripMB4 && is_string($str) && !empty($str)) { $str = $this->wire()->sanitizer->removeMB4($str); } - return $this->pdoLast()->quote($str); + return $this->pdoLast()->quote((string) $str); } /** diff --git a/wire/core/WireInput.php b/wire/core/WireInput.php index 72e20103..3d2c98fe 100644 --- a/wire/core/WireInput.php +++ b/wire/core/WireInput.php @@ -368,6 +368,7 @@ class WireInput extends Wire { $this->cookieVars = $this->wire(new WireInputDataCookie($_COOKIE, $this->lazy)); $this->cookieVars->init(); } + $key = (string) $key; if(!strlen($key)) return $this->cookieVars; if($valid === null && $fallback === null && !strpos($key, '[]')) return $this->cookieVars->get($key); return $this->getValidInputValue($this->cookieVars, $key, $valid, $fallback); diff --git a/wire/modules/Inputfield/InputfieldInteger.module b/wire/modules/Inputfield/InputfieldInteger.module index 205ace03..77130409 100644 --- a/wire/modules/Inputfield/InputfieldInteger.module +++ b/wire/modules/Inputfield/InputfieldInteger.module @@ -74,10 +74,10 @@ class InputfieldInteger extends Inputfield { } } - if(!strlen($attrs['value'])) { - if(strlen($this->initValue)) { + if(!strlen("$attrs[value]")) { + if(strlen("$this->initValue")) { $attrs['value'] = (int) $this->initValue; // Inputfield-only version - } else if(strlen($this->defaultValue)) { + } else if(strlen("$this->defaultValue")) { $attrs['value'] = (int) $this->defaultValue; // Fieldtype version } }