Control: tags 1095618 + patch
Control: tags 1095618 + pending

Dear maintainer,

I've prepared an NMU for libphp-adodb (versioned as 5.22.8-0.1) and
uploaded (with sponsor) it to DELAYED/5. Please feel free to tell me
if I should delay it longer. [1]

Regards.

[1] https://salsa.debian.org/leandrocunha/adodb

-- 
Cheers,
Leandro Cunha
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBGdTzVoBEADOhoTqLaOTfcJN2x7nNASOADc24NjmyBdxUwilTr4UzIPB9ojF
fcRSLz6Lg3n4p7Ff/yF35kk4iSGHyJ13YecNkAtVrZNG+5XaHvjRm38+6jeXZKyD
Ir8lp54ddJ4+rtZQ398TTKxjD7O0FiLCoDKkPoTYO4Qh0VJf6PXWMBmw6wxeXWP1
KS/xo2ttEXHVt6wyRVfRZN9Y/NPAfzonJ1dIM6C+prHlZQT+p7N/B9OM3HRXReHk
olxYRTbId3Qh1utt+TgqWdZJQW676d9q8/Z7D7VZiXBlopn5dyDeHo8q4vdeWk8P
EZDIOVSbOmXzt88vpfXFIpmIJzd0GX/oTDG913qdFqCY9HPr9dkfUBKFERcdxgI4
pYyWQ2YmOsN1by6x8YZYt+fzED+FXGVdof/d22cFJpPGiOHG3DwJxVaRQOXrbRHj
PiyR8bcAYASRe4AleWVXu86vTzMnRbAi/u83IMmwuKrqrfFP0J42ZAfyV9rOHADg
4UDCm3PKxIgezDJTm8DtiJcWPQRjocIO+nVX1crAXB2ymBfLXvTq0miyGC3UU3He
fIPE6azg4tMq1R5U3OckpnNUtyD5MqM/r0lLXUzIpRb/HjgtNnN6cCNrnAcUTDqJ
BatrVw7RciqVb78bAh/Fa1SJ6r2o57VrcKJ1bGXXCvhtvd+cwP7XtavXLQARAQAB
tI5MZWFuZHJvIGRhIEN1bmhhIERvbWluZ3VlcyAoRGVmYXVsdCBHUEcga2V5IHVu
dGlsIGV4cGlyYXRpb24gZGF0ZSBmb3Igc2lnbmluZyBwYWNrYWdlcywgY29tbWl0
cywgZW1haWxzIGFuZCB0YWdzLik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epMUbJ2sVbFdFhUZzSId
Ud4wBDk3oNiBdrXRfUfSGmx5B+PAjlzdG3ng7ME8kmsMKR/Fkg55zR1QAWWiWMR3
2n0phaKUe2Nqgk59wZUlBCOEuqpy8jvTGHKt8YmoFKjI5U7awsBav9V1iLcfmwbQ
flAYwMljzb9tvbAZvuK8QJBeAndcLg==
=JKeL
-----END PGP PUBLIC KEY BLOCK-----
diff -Nru libphp-adodb-5.22.7/adodb-active-record.inc.php libphp-adodb-5.22.8/adodb-active-record.inc.php
--- libphp-adodb-5.22.7/adodb-active-record.inc.php	2023-11-04 19:25:49.000000000 -0300
+++ libphp-adodb-5.22.8/adodb-active-record.inc.php	2025-01-24 22:10:09.000000000 -0300
@@ -1055,10 +1055,10 @@
 		$valarr = array();
 		$neworig = array();
 		$pairs = array();
-		$i = -1;
+		$i = 0;
 		$cnt = 0;
 		foreach($table->flds as $name=>$fld) {
-			$i += 1;
+			$orig = $this->_original[$i++] ?? null;
 			$val = $this->$name;
 			$neworig[] = $val;
 
@@ -1078,11 +1078,7 @@
 				}
 			}
 
-			if (isset($this->_original[$i]) && strcmp($val,$this->_original[$i]) == 0) {
-				continue;
-			}
-
-			if (is_null($this->_original[$i]) && is_null($val)) {
+			if ($val === $orig) {
 				continue;
 			}
 
diff -Nru libphp-adodb-5.22.7/adodb-active-recordx.inc.php libphp-adodb-5.22.8/adodb-active-recordx.inc.php
--- libphp-adodb-5.22.7/adodb-active-recordx.inc.php	2023-11-04 19:25:49.000000000 -0300
+++ libphp-adodb-5.22.8/adodb-active-recordx.inc.php	2025-01-24 22:10:09.000000000 -0300
@@ -1142,10 +1142,10 @@
 		$valarr = array();
 		$neworig = array();
 		$pairs = array();
-		$i = -1;
+		$i = 0;
 		$cnt = 0;
 		foreach($table->flds as $name=>$fld) {
-			$i += 1;
+			$orig = $this->_original[$i++] ?? null;
 			$val = $this->$name;
 			$neworig[] = $val;
 
@@ -1165,7 +1165,7 @@
 				}
 			}
 
-			if (isset($this->_original[$i]) && $val === $this->_original[$i]) {
+			if ($val === $orig) {
 				continue;
 			}
 			$valarr[] = $val;
diff -Nru libphp-adodb-5.22.7/adodb-datadict.inc.php libphp-adodb-5.22.8/adodb-datadict.inc.php
--- libphp-adodb-5.22.7/adodb-datadict.inc.php	2023-11-04 19:25:49.000000000 -0300
+++ libphp-adodb-5.22.8/adodb-datadict.inc.php	2025-01-24 22:10:09.000000000 -0300
@@ -510,10 +510,12 @@
 	 *
 	 * As some DBMs can't do that on their own, you need to supply the complete definition of the new table,
 	 * to allow recreating the table and copying the content over to the new table
-	 * @param string $tabname table-name
-	 * @param string $flds column-name and type for the changed column
-	 * @param string $tableflds='' complete definition of the new table, eg. for postgres, default ''
+	 *
+	 * @param string       $tabname table-name
+	 * @param array|string $flds column-name and type for the changed column
+	 * @param string       $tableflds='' complete definition of the new table, eg. for postgres, default ''
 	 * @param array|string $tableoptions='' options for the new table see createTableSQL, default ''
+	 *
 	 * @return array with SQL strings
 	 */
 	function alterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
@@ -1027,7 +1029,6 @@
 	function changeTableSQL($tablename, $flds, $tableoptions = false, $dropOldFlds=false)
 	{
 	global $ADODB_FETCH_MODE;
-
 		$save = $ADODB_FETCH_MODE;
 		$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
 		if ($this->connection->fetchMode !== false) $savem = $this->connection->setFetchMode(false);
@@ -1045,12 +1046,15 @@
 			return $this->createTableSQL($tablename, $flds, $tableoptions);
 		}
 
+		$sql = [];
 		if (is_array($flds)) {
 		// Cycle through the update fields, comparing
 		// existing fields to fields to update.
 		// if the Metatype and size is exactly the
 		// same, ignore - by Mark Newham
 			$holdflds = array();
+			$fields_to_add = [];
+			$fields_to_alter = [];
 			foreach($flds as $k=>$v) {
 				if ( isset($cols[$k]) && is_object($cols[$k]) ) {
 					// If already not allowing nulls, then don't change
@@ -1074,15 +1078,20 @@
 					if ($mt == 'X') $ml = $v['SIZE'];
 					if (($mt != $v['TYPE']) || ($ml != $fsize || $sc != $fprec) || (isset($v['AUTOINCREMENT']) && $v['AUTOINCREMENT'] != $obj->auto_increment)) {
 						$holdflds[$k] = $v;
+						$fields_to_alter[$k] = $v;
 					}
 				} else {
+					$fields_to_add[$k] = $v;
 					$holdflds[$k] = $v;
 				}
 			}
 			$flds = $holdflds;
-		}
 
-		$sql = $this->alterColumnSql($tablename, $flds);
+			$sql = array_merge(
+				$this->addColumnSQL($tablename, $fields_to_add),
+				$this->alterColumnSql($tablename, $fields_to_alter)
+			);
+		}
 
 		if ($dropOldFlds) {
 			foreach ($cols as $id => $v) {
diff -Nru libphp-adodb-5.22.7/adodb.inc.php libphp-adodb-5.22.8/adodb.inc.php
--- libphp-adodb-5.22.7/adodb.inc.php	2023-11-04 19:25:49.000000000 -0300
+++ libphp-adodb-5.22.8/adodb.inc.php	2025-01-24 22:10:09.000000000 -0300
@@ -198,7 +198,7 @@
 		/**
 		 * ADODB version as a string.
 		 */
-		$ADODB_vers = 'v5.22.7  2023-11-04';
+		$ADODB_vers = 'v5.22.8  2025-01-25';
 
 		/**
 		 * Determines whether recordset->RecordCount() is used.
@@ -4300,6 +4300,8 @@
 	 */
 	function getAssoc($force_array = false, $first2cols = false)
 	{
+		global $ADODB_FETCH_MODE;
+
 		/*
 		* Insufficient rows to show data
 		*/
@@ -4322,8 +4324,8 @@
 		* Get the fetch mode when the call was executed, this may be
 		* different than ADODB_FETCH_MODE
 		*/
-		$fetchMode = $this->connection->fetchMode;
-		if ($fetchMode == ADODB_FETCH_BOTH) {
+		$fetchMode = $this->adodbFetchMode;
+		if ($fetchMode == ADODB_FETCH_BOTH || $fetchMode == ADODB_FETCH_DEFAULT) {
 			/*
 			* If we are using BOTH, we present the data as if it
 			* was in ASSOC mode. This could be enhanced by adding
@@ -4355,7 +4357,7 @@
 
 			$myFields = $this->fields;
 
-			if ($fetchMode == ADODB_FETCH_BOTH) {
+			if ($fetchMode == ADODB_FETCH_BOTH || $fetchMode == ADODB_FETCH_DEFAULT) {
 				/*
 				* extract the associative keys
 				*/
diff -Nru libphp-adodb-5.22.7/adodb-lib.inc.php libphp-adodb-5.22.8/adodb-lib.inc.php
--- libphp-adodb-5.22.7/adodb-lib.inc.php	2023-11-04 19:25:49.000000000 -0300
+++ libphp-adodb-5.22.8/adodb-lib.inc.php	2025-01-24 22:10:09.000000000 -0300
@@ -366,7 +366,7 @@
 function _adodb_getmenu_option($defstr, $compare, $value, $display)
 {
 	if (   is_array($defstr) && in_array($compare, $defstr)
-		|| !is_array($defstr) && strcasecmp($compare, $defstr) == 0
+		|| !is_array($defstr) && strcasecmp($compare, $defstr ?? '') == 0
 	) {
 		$selected = ' selected="selected"';
 	} else {
@@ -376,18 +376,23 @@
 	return "\n<option $value$selected>" . htmlspecialchars($display) . '</option>';
 }
 
-/*
-	Count the number of records this sql statement will return by using
-	query rewriting heuristics...
-
-	Does not work with UNIONs, except with postgresql and oracle.
-
-	Usage:
-
-	$conn->Connect(...);
-	$cnt = _adodb_getcount($conn, $sql);
-
-*/
+/**
+ * Count the number of records this sql statement will return by using
+ * query rewriting heuristics...
+ *
+ * Does not work with UNIONs, except with postgresql and oracle.
+ *
+ * Usage:
+ *     $conn->Connect(...);
+ *     $cnt = _adodb_getcount($conn, $sql);
+ *
+ * @param ADOConnection $zthis
+ * @param string        $sql
+ * @param bool          $inputarr
+ * @param int           $secs2cache
+ *
+ * @return false|int|mixed
+ */
 function _adodb_getcount($zthis, $sql,$inputarr=false,$secs2cache=0)
 {
 	$qryRecs = 0;
@@ -1381,7 +1386,7 @@
 		$s .= '</pre>';
 	}
 	if ($printOrArr) {
-		print $s;
+		ADOConnection::outp($s);
 	}
 
 	return $s;
diff -Nru libphp-adodb-5.22.7/debian/changelog libphp-adodb-5.22.8/debian/changelog
--- libphp-adodb-5.22.7/debian/changelog	2024-06-13 21:28:14.000000000 -0300
+++ libphp-adodb-5.22.8/debian/changelog	2025-02-09 17:20:13.000000000 -0300
@@ -1,3 +1,11 @@
+libphp-adodb (5.22.8-0.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * New upstream version 5.22.8. (Closes: #1095618)
+    + Improve PHP 8.x compatibility and several fixes by upstream.
+
+ -- Leandro Cunha <leandrocunha...@gmail.com>  Sun, 09 Feb 2025 17:20:13 -0300
+
 libphp-adodb (5.22.7-0.1) unstable; urgency=medium
 
   [ Leandro Cunha ]
diff -Nru libphp-adodb-5.22.7/docs/changelog.md libphp-adodb-5.22.8/docs/changelog.md
--- libphp-adodb-5.22.7/docs/changelog.md	2023-11-04 19:25:49.000000000 -0300
+++ libphp-adodb-5.22.8/docs/changelog.md	2025-01-24 22:10:09.000000000 -0300
@@ -14,6 +14,45 @@
 
 --------------------------------------------------------------------------------
 
+## [5.22.8] - 2025-01-25
+
+### Added
+
+- mysql: allow forcing use of emulated prepared statements
+  [#1028](https://github.com/ADOdb/ADOdb/issues/1028)
+- Georgian language strings
+  [#1042](https://github.com/ADOdb/ADOdb/issues/1042)
+
+### Changed
+
+- mysqli: Improve setConnectionParameter()
+  [#1044](https://github.com/ADOdb/ADOdb/issues/1044)
+  
+### Fixed
+
+- Backtrace output is not channeled through ADODB_OUTP
+  [#1018](https://github.com/ADOdb/ADOdb/issues/1018)
+- changeColumnSQL not handling new vs changed columns correctly #1010
+  [#1010](https://github.com/ADOdb/ADOdb/issues/1010)
+- PHP 8 compatibility
+  [#1009](https://github.com/ADOdb/ADOdb/issues/1009)
+  [#1012](https://github.com/ADOdb/ADOdb/issues/1012)
+  [#1021](https://github.com/ADOdb/ADOdb/issues/1021)
+  [#1045](https://github.com/ADOdb/ADOdb/issues/1045)
+- db2: fix connections using *LOCAL on IBM i series
+  [#1031](https://github.com/ADOdb/ADOdb/issues/1031)
+  [#1032](https://github.com/ADOdb/ADOdb/issues/1032)
+- mysqli: catch getAssoc() execution error in metaColumns()
+  [#1016](https://github.com/ADOdb/ADOdb/issues/1016)
+- mysqli: fix getAssoc() with ADODB_FETCH_DEFAULT mode
+  [#1023](https://github.com/ADOdb/ADOdb/issues/1023)
+- mysqli: SSL not working due to wrong socket/flags
+  [#919](https://github.com/ADOdb/ADOdb/issues/919)
+  [#1043](https://github.com/ADOdb/ADOdb/issues/1043)
+- pgsql: fix serverInfo() version number
+  [#1059](https://github.com/ADOdb/ADOdb/issues/1059)
+
+
 ## [5.22.7] - 2023-11-04
 
 ### Fixed
@@ -1434,6 +1473,7 @@
 - Adodb5 version,more error checking code now will use exceptions if available.
 
 
+[5.22.8]: https://github.com/adodb/adodb/compare/v5.22.7...v5.22.8
 [5.22.7]: https://github.com/adodb/adodb/compare/v5.22.6...v5.22.7
 [5.22.6]: https://github.com/adodb/adodb/compare/v5.22.5...v5.22.6
 [5.22.5]: https://github.com/adodb/adodb/compare/v5.22.4...v5.22.5
diff -Nru libphp-adodb-5.22.7/drivers/adodb-db2.inc.php libphp-adodb-5.22.8/drivers/adodb-db2.inc.php
--- libphp-adodb-5.22.7/drivers/adodb-db2.inc.php	2023-11-04 19:25:49.000000000 -0300
+++ libphp-adodb-5.22.8/drivers/adodb-db2.inc.php	2025-01-24 22:10:09.000000000 -0300
@@ -109,10 +109,12 @@
 			return null;
 		}
 
-		$connectionParameters = $this->unpackParameters($argDSN,
-														$argUsername,
-														$argPassword,
-														$argDatabasename);
+		$connectionParameters = $this->unpackParameters(
+			$argDSN,
+			$argUsername,
+			$argPassword,
+			$argDatabasename
+		);
 
 		if ($connectionParameters == null)
 		{
@@ -129,7 +131,12 @@
 		$useCataloguedConnection = $connectionParameters['catalogue'];
 
 		if ($this->debug){
-			if ($useCataloguedConnection){
+			if (strcmp($argDSN,'*LOCAL') == 0)
+			{
+				$connectMessage = '*LOCAL connection';
+			}
+			else if ($useCataloguedConnection)
+			{
 				$connectMessage = "Catalogued connection using parameters: ";
 				$connectMessage .= "DB=$argDatabasename / ";
 				$connectMessage .= "UID=$argUsername / ";
@@ -141,6 +148,7 @@
 			}
 			ADOConnection::outp($connectMessage);
 		}
+
 		/*
 		 * This needs to be set before the connect().
 		 */
@@ -164,14 +172,17 @@
 		}
 
 		if ($useCataloguedConnection)
+		{
 			$this->_connectionID = $db2Function($argDatabasename,
 												$argUsername,
 												$argPassword,
 												$db2Options);
+		}
 		else
+		
 			$this->_connectionID = $db2Function($argDSN,
-												null,
-												null,
+												'',
+												'',
 												$db2Options);
 
 
@@ -180,6 +191,9 @@
 		if ($this->_connectionID && $this->connectStmt)
 			$this->execute($this->connectStmt);
 
+		if ($this->_connectionID && $argDatabasename)
+			$this->execute("SET SCHEMA=$argDatabasename");
+		
 		return $this->_connectionID != false;
 
 	}
@@ -198,12 +212,25 @@
 	{
 
 
-		$connectionParameters = array('dsn'=>'',
-									  'uid'=>'',
-									  'pwd'=>'',
-									  'database'=>'',
-									  'catalogue'=>true
-									  );
+		$connectionParameters = array(
+			'dsn'=>'',
+			'uid'=>'',
+			'pwd'=>'',
+			'database'=>'',
+			'catalogue'=>true
+		);
+
+		/*
+		* Shortcut for *LOCAL
+		*/
+		if (strcmp($argDSN,'*LOCAL') == 0)
+		{
+			$connectionParameters['dsn']      = $argDSN;
+			$connectionParameters['database'] = $argDatabasename;
+			$connectionParameters['catalogue'] = false;
+			
+			return $connectionParameters;
+		}
 
 		/*
 		 * Uou can either connect to a catalogued connection
diff -Nru libphp-adodb-5.22.7/drivers/adodb-ldap.inc.php libphp-adodb-5.22.8/drivers/adodb-ldap.inc.php
--- libphp-adodb-5.22.7/drivers/adodb-ldap.inc.php	2023-11-04 19:25:49.000000000 -0300
+++ libphp-adodb-5.22.8/drivers/adodb-ldap.inc.php	2025-01-24 22:10:09.000000000 -0300
@@ -76,7 +76,7 @@
 			if ($this->debug) ADOConnection::outp($e);
 			return false;
 		}
-		if( count( $LDAP_CONNECT_OPTIONS ) > 0 ) {
+		if(!empty($LDAP_CONNECT_OPTIONS)) {
 			$this->_inject_bind_options( $LDAP_CONNECT_OPTIONS );
 		}
 
diff -Nru libphp-adodb-5.22.7/drivers/adodb-mysqli.inc.php libphp-adodb-5.22.8/drivers/adodb-mysqli.inc.php
--- libphp-adodb-5.22.7/drivers/adodb-mysqli.inc.php	2023-11-04 19:25:49.000000000 -0300
+++ libphp-adodb-5.22.8/drivers/adodb-mysqli.inc.php	2025-01-24 22:10:09.000000000 -0300
@@ -75,6 +75,25 @@
 	var $ssl_capath = null;
 	var $ssl_cipher = null;
 
+	/**
+	 * Forcing emulated prepared statements.
+	 *
+	 * When set to true, ADODb will not execute queries using MySQLi native
+	 * bound variables, and will instead use the built-in string interpolation
+	 * and argument quoting from the parent class {@see ADOConnection::Execute()}.
+	 *
+	 * This is needed for some database engines that use mysql wire-protocol but
+	 * do not support prepared statements, like
+	 * {@see https://manticoresearch.com/ Manticore Search} or
+	 * {@see https://clickhouse.com/ ClickHouse}.
+	 *
+	 * WARNING: This is a potential security risk, and strongly discouraged for code
+	 * handling untrusted input {@see https://github.com/ADOdb/ADOdb/issues/1028#issuecomment-2081586024}.
+	 *
+	 * @var bool $doNotUseBoundVariables
+	 */
+	var $doNotUseBoundVariables = false;
+
 	/** @var mysqli Identifier for the native database connection */
 	var $_connectionID = false;
 
@@ -126,22 +145,74 @@
 	}
 
 	/**
-	 * Adds a parameter to the connection string.
+	 * Adds a parameter to the connection string, can also set connection property values.
 	 *
 	 * Parameter must be one of the constants listed in mysqli_options().
 	 * @see https://www.php.net/manual/en/mysqli.options.php
-	 *
-	 * @param int    $parameter The parameter to set
-	 * @param string $value     The value of the parameter
+	 * 
+	 * OR 
+	 * 
+	 * Parameter must be a string matching one of the following special cases.
+	 * 'ssl' - SSL values e.g. ('ssl' => ['ca' => '/path/to/ca.crt.pem'])
+	 * 'clientflags' - Client flags of type 'MYSQLI_CLIENT_'
+	 * @see https://www.php.net/manual/en/mysqli.real-connect.php
+	 * @see https://www.php.net/manual/en/mysqli.constants.php
+	 * 'socket' - The socket or named pipe that should be used
+	 * 'port' - The port number to attempt to connect to the MySQL server
+	 * 
+	 * @param string|int $parameter The parameter to set
+	 * @param string|int|array $value The value of the parameter
 	 *
 	 * @return bool
 	 */
 	public function setConnectionParameter($parameter, $value) {
-		if(!is_numeric($parameter)) {
-			$this->outp_throw("Invalid connection parameter '$parameter'", __METHOD__);
-			return false;
+
+		// Special case for setting SSL values.
+		if ("ssl" === $parameter && is_array($value)) {
+			if (isset($value["key"])) {
+				$this->ssl_key = $value["key"];
+			}
+			if (isset($value["cert"])) {
+				$this->ssl_cert = $value["cert"];
+			}
+			if (isset($value["ca"])) {
+				$this->ssl_ca = $value["ca"];
+			}
+			if (isset($value["capath"])) {
+				$this->ssl_capath = $value["capath"];
+			}
+			if (isset($value["cipher"])) {
+				$this->ssl_cipher = $value["cipher"];
+			}
+
+			return true;
+		}
+
+		// Special case for setting the client flag(s).
+		if ("clientflags" === $parameter && is_numeric($value)) {
+			$this->clientFlags = $value;
+			return true;
+		}
+
+		// Special case for setting the socket.
+		if ("socket" === $parameter && is_string($value)) {
+			$this->socket = $value;
+			return true;
+		}
+
+		// Special case for setting the port.
+		if ("port" === $parameter && is_numeric($value)) {
+			$this->port = (int)$value;
+			return true;
+		}
+
+		// Standard mysqli_options.
+		if (is_numeric($parameter)) {
+			return parent::setConnectionParameter($parameter, $value);
 		}
-		return parent::setConnectionParameter($parameter, $value);
+
+		$this->outp_throw("Invalid connection parameter '$parameter'", __METHOD__);
+		return false;
 	}
 
 	/**
@@ -214,9 +285,14 @@
 
 		// SSL Connections for MySQLI
 		if ($this->ssl_key || $this->ssl_cert || $this->ssl_ca || $this->ssl_capath || $this->ssl_cipher) {
+
 			mysqli_ssl_set($this->_connectionID, $this->ssl_key, $this->ssl_cert, $this->ssl_ca, $this->ssl_capath, $this->ssl_cipher);
-			$this->socket = MYSQLI_CLIENT_SSL;
-			$this->clientFlags = MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
+
+			// Check for any SSL client flag set, NOTE: bitwise operation.
+			if (!($this->clientFlags & MYSQLI_CLIENT_SSL)) {
+        			ADOConnection::outp('When using certificates, set the client flag MYSQLI_CLIENT_SSL_VERIFY_SERVER_CERT or MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT');
+				return false;
+			}
 		}
 
 		#if (!empty($this->port)) $argHostname .= ":".$this->port;
@@ -944,9 +1020,11 @@
 				   AND table_name='$table'";
 
 		$schemaArray = $this->getAssoc($SQL);
-		$schemaArray = array_change_key_case($schemaArray,CASE_LOWER);
+		if (is_array($schemaArray)) {
+			$schemaArray = array_change_key_case($schemaArray,CASE_LOWER);
+			$rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
+		}
 
-		$rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
 		if (isset($savem)) $this->SetFetchMode($savem);
 		$ADODB_FETCH_MODE = $save;
 		if (!is_object($rs))
@@ -1101,6 +1179,10 @@
 
 	public function execute($sql, $inputarr = false)
 	{
+		if ($this->doNotUseBoundVariables) {
+			return parent::execute($sql, $inputarr);
+		}
+
 		if ($this->fnExecute) {
 			$fn = $this->fnExecute;
 			$ret = $fn($this, $sql, $inputarr);
diff -Nru libphp-adodb-5.22.7/drivers/adodb-oci8.inc.php libphp-adodb-5.22.8/drivers/adodb-oci8.inc.php
--- libphp-adodb-5.22.7/drivers/adodb-oci8.inc.php	2023-11-04 19:25:49.000000000 -0300
+++ libphp-adodb-5.22.8/drivers/adodb-oci8.inc.php	2025-01-24 22:10:09.000000000 -0300
@@ -1576,11 +1576,8 @@
 	 */
 	function qStr($s, $magic_quotes=false)
 	{
-		if ($this->noNullStrings && strlen($s) == 0) {
-			$s = ' ';
-		}
-		else if (strlen($s) == 0) {
-			return "''";
+		if (strlen((string)$s) == 0) {
+			return $this->noNullStrings ? "' '" : "''";
 		}
 		if ($this->replaceQuote[0] == '\\'){
 			$s = str_replace('\\','\\\\',$s);
diff -Nru libphp-adodb-5.22.7/drivers/adodb-postgres64.inc.php libphp-adodb-5.22.8/drivers/adodb-postgres64.inc.php
--- libphp-adodb-5.22.7/drivers/adodb-postgres64.inc.php	2023-11-04 19:25:49.000000000 -0300
+++ libphp-adodb-5.22.8/drivers/adodb-postgres64.inc.php	2025-01-24 22:10:09.000000000 -0300
@@ -113,13 +113,12 @@
 			}
 
 			$version = pg_version($this->_connectionID);
+			// If PHP has been compiled with PostgreSQL 7.3 or lower, then
+			// server_version is not set so we use pg_parameter_status() instead.
+			$version_server = $version['server'] ?? pg_parameter_status($this->_connectionID, 'server_version');
+
 			$this->version = array(
-				// If PHP has been compiled with PostgreSQL 7.3 or lower, then
-				// server version is not set so we use pg_parameter_status()
-				// which includes logic to obtain values server_version
-				'version' => isset($version['server'])
-					? $version['server']
-					: pg_parameter_status($this->_connectionID, 'server_version'),
+				'version' => $this->_findvers($version_server),
 				'client' => $version['client'],
 				'description' => null,
 			);
diff -Nru libphp-adodb-5.22.7/lang/adodb-ka.inc.php libphp-adodb-5.22.8/lang/adodb-ka.inc.php
--- libphp-adodb-5.22.7/lang/adodb-ka.inc.php	1969-12-31 21:00:00.000000000 -0300
+++ libphp-adodb-5.22.8/lang/adodb-ka.inc.php	2025-01-24 22:10:09.000000000 -0300
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Georgian language strings.
+ *
+ * This file is part of ADOdb, a Database Abstraction Layer library for PHP.
+ *
+ * @package ADOdb
+ * @link https://adodb.org Project's web site and documentation
+ * @link https://github.com/ADOdb/ADOdb Source code and issue tracker
+ *
+ * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause
+ * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option,
+ * any later version. This means you can use it in proprietary products.
+ * See the LICENSE.md file distributed with this source code for details.
+ * @license BSD-3-Clause
+ * @license LGPL-2.1-or-later
+ *
+ * @copyright 2000-2013 John Lim
+ * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community
+ * @author Temuri Doghonadze <temuri.doghona...@gmail.com>
+ */
+
+$ADODB_LANG_ARRAY = array (
+             'LANG'                      => 'ka',
+            DB_ERROR                    => 'უცნობი შეცდომა',
+            DB_ERROR_ALREADY_EXISTS     => 'უკვე არსებობს',
+            DB_ERROR_CANNOT_CREATE      => 'შექმნა შეუძლებელია',
+            DB_ERROR_CANNOT_DELETE      => 'წაშლა შეუძლებელია',
+            DB_ERROR_CANNOT_DROP        => 'წაშლა შეუძლებელია (drop)',
+            DB_ERROR_CONSTRAINT         => 'შეზღუდვის პირობის დარღვევა',
+            DB_ERROR_DIVZERO            => '0-ზე გაყოფა',
+            DB_ERROR_INVALID            => 'არასწორია',
+            DB_ERROR_INVALID_DATE       => 'არასწორი თარიღი ან დრო',
+            DB_ERROR_INVALID_NUMBER     => 'არასწორი რიცხვი',
+            DB_ERROR_MISMATCH           => 'შეცდომა',
+            DB_ERROR_NODBSELECTED       => 'მონაცემთა ბაზა არჩეული არაა',
+            DB_ERROR_NOSUCHFIELD        => 'ველი არ არსებობს',
+            DB_ERROR_NOSUCHTABLE        => 'ცხრილი არ არსებობს',
+            DB_ERROR_NOT_CAPABLE        => 'მონაცემთა ბაზა მზად არაა',
+            DB_ERROR_NOT_FOUND          => 'აღმოჩენილი არაა',
+            DB_ERROR_NOT_LOCKED         => 'დაბლოკილი არაა',
+            DB_ERROR_SYNTAX             => 'სინტაქსური შეცდომა',
+            DB_ERROR_UNSUPPORTED        => 'მხარდაჭერიი არაა',
+            DB_ERROR_VALUE_COUNT_ON_ROW => 'მწკრივის მნიშვნელობების მთვლელი',
+            DB_ERROR_INVALID_DSN        => 'არასწორი DSN',
+            DB_ERROR_CONNECT_FAILED     => 'დაკავშირება შეუძლებელია',
+            0                               => 'შეცდომის გარეშე', // DB_OK
+            DB_ERROR_NEED_MORE_DATA     => 'მიწოდებულია არასაკმარისი მონაცემები',
+            DB_ERROR_EXTENSION_NOT_FOUND=> 'გაფართოება აღმოჩენილი არაა',
+            DB_ERROR_NOSUCHDB           => 'მონაცემთა ბაზა არ არსებობს',
+            DB_ERROR_ACCESS_VIOLATION   => 'არასაკმარისი წვდომები'
+);
diff -Nru libphp-adodb-5.22.7/toexport.inc.php libphp-adodb-5.22.8/toexport.inc.php
--- libphp-adodb-5.22.7/toexport.inc.php	2023-11-04 19:25:49.000000000 -0300
+++ libphp-adodb-5.22.8/toexport.inc.php	2025-01-24 22:10:09.000000000 -0300
@@ -107,9 +107,9 @@
 		if ($hasNumIndex) {
 			for ($j=0; $j < $max; $j++) {
 				$v = $rs->fields[$j];
-				if (!is_object($v)) $v = trim($v);
+				if (!is_object($v)) $v = trim((string)$v);
 				else $v = 'Object';
-				if ($escquote) $v = str_replace($quote,$escquotequote,$v);
+				if ($escquote) $v = str_replace($quote,$escquotequote,(string)$v);
 				$v = strip_tags(str_replace("\n", $replaceNewLine, str_replace("\r\n",$replaceNewLine,str_replace($sep,$sepreplace,$v))));
 
 				if (strpos($v,$sep) !== false || strpos($v,$quote) !== false) $elements[] = "$quote$v$quote";
@@ -117,8 +117,8 @@
 			}
 		} else { // ASSOCIATIVE ARRAY
 			foreach($rs->fields as $v) {
-				if ($escquote) $v = str_replace($quote,$escquotequote,trim($v));
-				$v = strip_tags(str_replace("\n", $replaceNewLine, str_replace("\r\n",$replaceNewLine,str_replace($sep,$sepreplace,$v))));
+				if ($escquote) $v = str_replace($quote,$escquotequote,trim((string)$v));
+				$v = strip_tags(str_replace("\n", $replaceNewLine, str_replace("\r\n",$replaceNewLine,str_replace($sep,$sepreplace,(string)$v))));
 
 				if (strpos($v,$sep) !== false || strpos($v,$quote) !== false) $elements[] = "$quote$v$quote";
 				else $elements[] = $v;

Reply via email to