From c121a1aa1f82dd9a1d4509a1e7c7a18d44416d83 Mon Sep 17 00:00:00 2001 From: Konstantin Tarasov Date: Tue, 24 Jun 2025 16:21:52 +0300 Subject: Active record: handle empty string in dbquote() The method did not generate the appropriate quote for empty strings, resulting in invalid SQL syntax in the UPDATE statement's where clause. Fix #1073, PR #1074 --- adodb-active-recordx.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'adodb-active-recordx.inc.php') diff --git a/adodb-active-recordx.inc.php b/adodb-active-recordx.inc.php index 18e2a189..21ab47b2 100644 --- a/adodb-active-recordx.inc.php +++ b/adodb-active-recordx.inc.php @@ -762,7 +762,7 @@ class ADODB_Active_Record { } // quote data in where clause - function doquote(&$db, $val,$t) + function doquote(&$db, $val, $t) { switch($t) { case 'D': @@ -775,6 +775,9 @@ class ADODB_Active_Record { if (is_null($val)) { return 'null'; } + if ('' === (string) $val) { + return "''"; + } if (strlen($val)>0 && (strncmp($val,"'",1) != 0 || substr($val,strlen($val)-1,1) != "'") ) { -- cgit v1.3