diff -Nru libphp-adodb-5.20.12/adodb-active-record.inc.php libphp-adodb-5.20.13/adodb-active-record.inc.php --- libphp-adodb-5.20.12/adodb-active-record.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/adodb-active-record.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,10 +1,10 @@ RecordCount() is used. @@ -431,6 +428,7 @@ var $databaseType = ''; /// RDBMS currently in use, eg. odbc, mysql, mssql var $database = ''; /// Name of database to be used. var $host = ''; /// The hostname of the database server + var $port = ''; /// The port of the database server var $user = ''; /// The username which is used to connect to the database server. var $password = ''; /// Password for the username. For security, we no longer store it. var $debug = false; /// if set to true will output sql statements @@ -633,6 +631,26 @@ } /** + * Parses the hostname to extract the port. + * Overwrites $this->host and $this->port, only if a port is specified. + * The Hostname can be fully or partially qualified, + * ie: "db.mydomain.com:5432" or "ldaps://ldap.mydomain.com:636" + * Any specified scheme such as ldap:// or ldaps:// is maintained. + */ + protected function parseHostNameAndPort() { + $parsed_url = parse_url($this->host); + if (is_array($parsed_url) && isset($parsed_url['host']) && isset($parsed_url['port'])) { + if ( isset($parsed_url['scheme']) ) { + // If scheme is specified (ie: ldap:// or ldaps://, make sure we retain that. + $this->host = $parsed_url['scheme'] . "://" . $parsed_url['host']; + } else { + $this->host = $parsed_url['host']; + } + $this->port = $parsed_url['port']; + } + } + + /** * Connect to database * * @param [argHostname] Host to connect to @@ -647,9 +665,9 @@ if ($argHostname != "") { $this->host = $argHostname; } - if ( strpos($this->host, ':') > 0 && isset($this->port) ) { - list($this->host, $this->port) = explode(":", $this->host, 2); - } + // Overwrites $this->host and $this->port if a port is specified. + $this->parseHostNameAndPort(); + if ($argUsername != "") { $this->user = $argUsername; } @@ -730,9 +748,9 @@ if ($argHostname != "") { $this->host = $argHostname; } - if ( strpos($this->host, ':') > 0 && isset($this->port) ) { - list($this->host, $this->port) = explode(":", $this->host, 2); - } + // Overwrites $this->host and $this->port if a port is specified. + $this->parseHostNameAndPort(); + if ($argUsername != "") { $this->user = $argUsername; } diff -Nru libphp-adodb-5.20.12/adodb-iterator.inc.php libphp-adodb-5.20.13/adodb-iterator.inc.php --- libphp-adodb-5.20.12/adodb-iterator.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/adodb-iterator.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,7 +1,7 @@ databaseType,'postgres',8) == 0 - || strncmp($zthis->databaseType,'mysql',5) == 0 - || strncmp($zthis->databaseType,'mssql',5) == 0 - ) { - $rewritesql = "SELECT COUNT(*) FROM ($rewritesql) _ADODB_ALIAS_"; - } else { - $rewritesql = "SELECT COUNT(*) FROM ($rewritesql)"; - } + } else if (strncmp($zthis->databaseType,'postgres',8) == 0 + || strncmp($zthis->databaseType,'mysql',5) == 0 + || strncmp($zthis->databaseType,'mssql',5) == 0 + || strncmp($zthis->dsnType,'sqlsrv',5) == 0 + || strncmp($zthis->dsnType,'mssql',5) == 0 + ){ + $rewritesql = "SELECT COUNT(*) FROM ($rewritesql) _ADODB_ALIAS_"; + } else { + $rewritesql = "SELECT COUNT(*) FROM ($rewritesql)"; + } } else { // now replace SELECT ... FROM with SELECT COUNT(*) FROM if ( strpos($sql, '_ADODB_COUNT') !== FALSE ) { @@ -769,7 +771,7 @@ if (preg_match('/\s(ORDER\s.*)/is', $whereClause[1], $discard)); else if (preg_match('/\s(LIMIT\s.*)/is', $whereClause[1], $discard)); else if (preg_match('/\s(FOR UPDATE.*)/is', $whereClause[1], $discard)); - else preg_match('/\s.*(\) WHERE .*)/is', $whereClause[1], $discard); # see http://sourceforge.net/tracker/index.php?func=detail&aid=1379638&group_id=42718&atid=433976 + else preg_match('/\s.*(\) WHERE .*)/is', $whereClause[1], $discard); # see https://sourceforge.net/p/adodb/bugs/37/ } else $whereClause = array(false,false); diff -Nru libphp-adodb-5.20.12/adodb-memcache.lib.inc.php libphp-adodb-5.20.13/adodb-memcache.lib.inc.php --- libphp-adodb-5.20.12/adodb-memcache.lib.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/adodb-memcache.lib.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -11,7 +11,7 @@ /* - @version v5.20.12 30-Mar-2018 + @version v5.20.13 06-Aug-2018 @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved. @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community Released under both BSD license and Lesser GPL library license. @@ -19,7 +19,7 @@ the BSD license will take precedence. See License.txt. Set tabs to 4 for best viewing. - Latest version is available at http://adodb.sourceforge.net + Latest version is available at http://adodb.org/ Usage: diff -Nru libphp-adodb-5.20.12/adodb-pager.inc.php libphp-adodb-5.20.13/adodb-pager.inc.php --- libphp-adodb-5.20.12/adodb-pager.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/adodb-pager.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,7 +1,7 @@ %s \r\n"; var $sql1 = 'sql1'; // used for casting sql1 to text for mssql var $explain = true; - var $helpurl = 'LogSQL help'; + var $helpurl = 'LogSQL help'; var $createTableSQL = false; var $maxLength = 2000; @@ -721,7 +721,7 @@ if (empty($_GET['hidem'])) echo "
- ADOdb Performance Monitor for $app
+ ADOdb Performance Monitor for $app
Performance Stats   View SQL   View Tables   Poll Stats", $allowsql ? '   Run SQL' : '', diff -Nru libphp-adodb-5.20.12/adodb-php4.inc.php libphp-adodb-5.20.13/adodb-php4.inc.php --- libphp-adodb-5.20.12/adodb-php4.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/adodb-php4.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,7 +1,7 @@ Tue, 28 Aug 2018 15:13:24 +0200 + libphp-adodb (5.20.12-1) unstable; urgency=medium * New upstream version. diff -Nru libphp-adodb-5.20.12/debian/control libphp-adodb-5.20.13/debian/control --- libphp-adodb-5.20.12/debian/control 2018-03-15 10:21:35.000000000 +0000 +++ libphp-adodb-5.20.13/debian/control 2018-08-28 13:13:24.000000000 +0000 @@ -5,7 +5,7 @@ Uploaders: Jean-Michel Vourgère Build-Depends: debhelper (>= 11), pkg-php-tools (>= 1.7~) Build-Depends-Indep: po-debconf -Standards-Version: 4.1.3 +Standards-Version: 4.2.1 Vcs-Git: https://salsa.debian.org/debian/adodb.git Vcs-Browser: https://salsa.debian.org/debian/adodb Homepage: http://adodb.org/ diff -Nru libphp-adodb-5.20.12/docs/changelog.md libphp-adodb-5.20.13/docs/changelog.md --- libphp-adodb-5.20.12/docs/changelog.md 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/docs/changelog.md 2018-08-06 16:04:33.000000000 +0000 @@ -5,6 +5,17 @@ [v3.x](changelog_v3.x.md), [v2.x](changelog_v2.x.md). +## 5.20.13 - 06-Aug-2018 + +- core: Fix query execution failures with mismatched quotes. #420 +- ldap: Fix connections using URIs. #340 +- mssql: Fix Time field format, allowing autoExecute() to inserting time. #432 +- mssql: Fix Insert_ID returning null with table name in brackets. #313 +- mssql: Fix count wrapper. #423 +- oci8: Fix prepared statements failure. #318 +- oci8po: Fix incorrect query parameter replacements. #370 +- pdo: fix PHP notice due to uninitialized variable. #437 + ## 5.20.12 - 30-Mar-2018 - adodb: PHP 7.2 compatibility @@ -361,7 +372,7 @@ - BeginTrans/CommitTrans/RollbackTrans return true/false correctly on success/failure now for mssql, odbc, oci8, mysqlt, mysqli, postgres, pdo. - Replace() now quotes all non-null values including numeric ones. - Postgresql qstr() now returns booleans as *true* and *false* without quotes. -- MetaForeignKeys in mysql and mysqli drivers had this problem: A table can have two foreign keys pointing to the same column in the same table. The original code will incorrectly report only the last column. Fixed. https://sourceforge.net/tracker/index.php?func=detail&aid=2287278&group_id=42718&atid=433976 +- MetaForeignKeys in mysql and mysqli drivers had this problem: A table can have two foreign keys pointing to the same column in the same table. The original code will incorrectly report only the last column. Fixed. https://sourceforge.net/p/adodb/bugs/100/ - Passing in full ado connection string in $argHostname with ado drivers was failing in adodb5 due to bug. Fixed. - Fixed memcachelib flushcache and flushall bugs. Also fixed possible timeCreated = 0 problem in readcache. (Also in adodb 4.992). Thanks AlexB_UK (alexbarnes#hotmail.com). - Fixed a notice in adodb-sessions2.inc.php, in _conn(). Thx bober m.derlukiewicz#rocktech.remove_me.pl; diff -Nru libphp-adodb-5.20.12/docs/changelog_v2.x.md libphp-adodb-5.20.13/docs/changelog_v2.x.md --- libphp-adodb-5.20.12/docs/changelog_v2.x.md 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/docs/changelog_v2.x.md 2018-08-06 16:04:33.000000000 +0000 @@ -377,7 +377,7 @@ ## 1.10 - 19 May 2001 - Added caching. CacheExecute() and CacheSelectLimit(). -- Added csv driver. See [http://php.weblogs.com/ADODB_csv](http://php.weblogs.com/adodb_csv). +- Added csv driver. - Fixed SelectLimit(), SELECT TOP not working under certain circumstances. - Added better Frontbase support of MetaTypes() by Frank M. Kromann. diff -Nru libphp-adodb-5.20.12/docs/changelog_v4.x.md libphp-adodb-5.20.13/docs/changelog_v4.x.md --- libphp-adodb-5.20.12/docs/changelog_v4.x.md 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/docs/changelog_v4.x.md 2018-08-06 16:04:33.000000000 +0000 @@ -214,7 +214,7 @@ - Removed `$off = $fieldOffset - 1` line in db2 driver, FetchField(). Tx Larry Menard. - Added support for PHP5 objects as Execute() bind parameters using `__toString` (eg. Simple-XML). Thx Carl-Christian Salvesen. - Rounding in tohtml.inc.php did not work properly. Fixed. -- MetaIndexes in postgres fails when fields are deleted then added in again because the attnum has gaps in it. See http://sourceforge.net/tracker/index.php?func=detail&aid=1451245&group_id=42718&atid=433976. Fixed. +- MetaIndexes in postgres fails when fields are deleted then added in again because the attnum has gaps in it. See https://sourceforge.net/p/adodb/bugs/45/. Fixed. - MetaForeignkeys in mysql and mysqli did not work when fetchMode==ADODB_FETCH_ASSOC used. Fixed. - Reference error in AutoExecute() fixed. - Added macaddr postgres type to MetaType. Maps to 'C'. diff -Nru libphp-adodb-5.20.12/drivers/adodb-access.inc.php libphp-adodb-5.20.13/drivers/adodb-access.inc.php --- libphp-adodb-5.20.12/drivers/adodb-access.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/drivers/adodb-access.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,6 +1,6 @@ qstr($v)); + + if (substr($v,0,1) == "'" && substr($v,-1,1) == "'") + /* + * String is already fully quoted + */ + $inputVar = $v; + else + $inputVar = $this->qstr($v); + + $params .= "@P$i=N" . $inputVar; } else if (is_integer($v)) { $decl .= "@P$i INT"; $params .= "@P$i=".$v; diff -Nru libphp-adodb-5.20.12/drivers/adodb-mssqlnative.inc.php libphp-adodb-5.20.13/drivers/adodb-mssqlnative.inc.php --- libphp-adodb-5.20.12/drivers/adodb-mssqlnative.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/drivers/adodb-mssqlnative.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,6 +1,6 @@ identitySQL; // select scope_identity() } @@ -916,7 +916,7 @@ { $_typeConversion = array( -155 => 'datetimeoffset', - -154 => 'time', + -154 => 'char', -152 => 'xml', -151 => 'udt', -11 => 'uniqueidentifier', diff -Nru libphp-adodb-5.20.12/drivers/adodb-mssql_n.inc.php libphp-adodb-5.20.13/drivers/adodb-mssql_n.inc.php --- libphp-adodb-5.20.12/drivers/adodb-mssql_n.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/drivers/adodb-mssql_n.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -7,7 +7,8 @@ // NOTICE OF COPYRIGHT // // // // ADOdb - Database Abstraction Library for PHP // -// http://adodb.sourceforge.net/ // +// // +// Latest version is available at http://adodb.org // // // // Copyright (c) 2000-2014 John Lim (jlim\@natsoft.com.my) // // All rights reserved. // diff -Nru libphp-adodb-5.20.12/drivers/adodb-mssqlpo.inc.php libphp-adodb-5.20.13/drivers/adodb-mssqlpo.inc.php --- libphp-adodb-5.20.12/drivers/adodb-mssqlpo.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/drivers/adodb-mssqlpo.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,6 +1,6 @@ @@ -1565,7 +1565,13 @@ $this->adodbFetchMode = $mode; $this->_queryID = $queryID; } - + + /** + * Overrides the core destructor method as that causes problems here + * + * @return void + */ + function __destruct() {} function Init() { diff -Nru libphp-adodb-5.20.12/drivers/adodb-oci8po.inc.php libphp-adodb-5.20.13/drivers/adodb-oci8po.inc.php --- libphp-adodb-5.20.12/drivers/adodb-oci8po.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/drivers/adodb-oci8po.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,13 +1,13 @@ 1) { - $sql = $sqlarr[0]; - - foreach ($inputarr as $k => $v) { - $sql .= ":$k" . $sqlarr[++$i]; - } - } - - $sql = str_replace('-QUESTIONMARK-', '?', $sql); + $sql = $this->extractBinds($sql,$inputarr); } } return ADODB_oci8::_query($sql,$inputarr); } + /** + * Replaces compatibility bind markers with oracle ones and returns a + * valid sql statement + * + * This replaces a regexp based section of code that has been subject + * to numerous tweaks, as more extreme test cases have appeared. This + * is now done this like this to help maintainability and avoid the + * need to rely on regexp experienced maintainers + * + * @param string $sql The sql statement + * @param string[] $inputarr The bind array + * + * @return string The modified statement + */ + final private function extractBinds($sql,$inputarr) + { + $inString = false; + $escaped = 0; + $sqlLength = strlen($sql) - 1; + $newSql = ''; + $bindCount = 0; + + /* + * inputarr is the passed in bind list, which is associative, but + * we only want the keys here + */ + $inputKeys = array_keys($inputarr); + + + for ($i=0;$i<=$sqlLength;$i++) + { + /* + * find the next character of the string + */ + $c = $sql{$i}; + + if ($c == "'" && !$inString && $escaped==0) + /* + * Found the start of a string inside the statement + */ + $inString = true; + elseif ($c == "\\" && $escaped==0) + /* + * The next character will be escaped + */ + $escaped = 1; + elseif ($c == "'" && $inString && $escaped==0) + /* + * We found the end of the string + */ + $inString = false; + + if ($escaped == 2) + $escaped = 0; + + if ($escaped==0 && !$inString && $c == '?') + /* + * We found a bind symbol, replace it with the oracle equivalent + */ + $newSql .= ':' . $inputKeys[$bindCount++]; + else + /* + * Add the current character the pile + */ + $newSql .= $c; + + if ($escaped == 1) + /* + * We have just found an escape character, make sure we ignore the + * next one that comes along, it might be a ' character + */ + $escaped = 2; + } + + return $newSql; + + } } /*-------------------------------------------------------------------------------------- diff -Nru libphp-adodb-5.20.12/drivers/adodb-oci8quercus.inc.php libphp-adodb-5.20.13/drivers/adodb-oci8quercus.inc.php --- libphp-adodb-5.20.12/drivers/adodb-oci8quercus.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/drivers/adodb-oci8quercus.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,13 +1,13 @@ diff -Nru libphp-adodb-5.20.12/drivers/adodb-odbtp_unicode.inc.php libphp-adodb-5.20.13/drivers/adodb-odbtp_unicode.inc.php --- libphp-adodb-5.20.12/drivers/adodb-odbtp_unicode.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/drivers/adodb-odbtp_unicode.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,13 +1,13 @@ diff -Nru libphp-adodb-5.20.12/drivers/adodb-oracle.inc.php libphp-adodb-5.20.13/drivers/adodb-oracle.inc.php --- libphp-adodb-5.20.12/drivers/adodb-oracle.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/drivers/adodb-oracle.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,13 +1,13 @@ MetaColumnNames($table,true,true); - //3rd param is use attnum, - // see http://sourceforge.net/tracker/index.php?func=detail&aid=1451245&group_id=42718&atid=433976 + // 3rd param is use attnum, + // see https://sourceforge.net/p/adodb/bugs/45/ $indexes = array(); while ($row = $rs->FetchRow()) { $columns = array(); diff -Nru libphp-adodb-5.20.12/drivers/adodb-postgres7.inc.php libphp-adodb-5.20.13/drivers/adodb-postgres7.inc.php --- libphp-adodb-5.20.12/drivers/adodb-postgres7.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/drivers/adodb-postgres7.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,6 +1,6 @@ Richard Tango-Lowy @@ -24,7 +24,7 @@ * * This storage driver can use all databases which are supported * by the ADBdb DB abstraction layer to fetch login data. - * See http://php.weblogs.com/adodb for information on ADOdb. + * See http://adodb.org/ for information on ADOdb. * NOTE: The ADOdb directory MUST be in your PHP include_path! * * @author Richard Tango-Lowy diff -Nru libphp-adodb-5.20.12/perf/perf-db2.inc.php libphp-adodb-5.20.13/perf/perf-db2.inc.php --- libphp-adodb-5.20.12/perf/perf-db2.inc.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/perf/perf-db2.inc.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,6 +1,6 @@ '; var_dump(parse_url('odbc_mssql://userserver/')); diff -Nru libphp-adodb-5.20.12/tests/test3.php libphp-adodb-5.20.13/tests/test3.php --- libphp-adodb-5.20.12/tests/test3.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/tests/test3.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,6 +1,6 @@ -For the latest version of ADODB, visit adodb.sourceforge.net.

+For the latest version of ADODB, visit adodb.org.

Test GetInsertSQL/GetUpdateSQL   Sessions   diff -Nru libphp-adodb-5.20.12/tests/test-php5.php libphp-adodb-5.20.13/tests/test-php5.php --- libphp-adodb-5.20.12/tests/test-php5.php 2018-03-30 17:31:04.000000000 +0000 +++ libphp-adodb-5.20.13/tests/test-php5.php 2018-08-06 16:04:33.000000000 +0000 @@ -1,6 +1,6 @@