Skip to content

Commit fd02059

Browse files
committed
Bump ADOdb version to fix PHP 8.1 bug.
1 parent 1b55cb2 commit fd02059

File tree

73 files changed

+245
-236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+245
-236
lines changed

libraries/adodb/adodb.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ function ADODB_Setup() {
198198
/**
199199
* ADODB version as a string.
200200
*/
201-
$ADODB_vers = 'v5.22.1 2022-03-30';
201+
$ADODB_vers = 'v5.22.2 2022-05-08';
202202

203203
/**
204204
* Determines whether recordset->RecordCount() is used.

libraries/adodb/docs/changelog.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@ Older changelogs:
1414

1515
--------------------------------------------------------------------------------
1616

17+
## [5.22.2] - 2022-05-08
18+
19+
### Fixed
20+
21+
- mssql: Automatic conversion of false to array is deprecated in PHP 8.1
22+
[#829](https://github.com/ADOdb/ADOdb/issues/829)
23+
- mysql: Affected_Rows() not returning correct value
24+
[#820](https://github.com/ADOdb/ADOdb/issues/820)
25+
- mysql: uncaught ValueError exception calling execute() with an empty array
26+
[#832](https://github.com/ADOdb/ADOdb/issues/832)
27+
- pgsql: Affected_Rows() always returns false on PHP 8.1
28+
[#833](https://github.com/ADOdb/ADOdb/issues/833)
29+
30+
1731
## [5.22.1] - 2022-03-30
1832

1933
### Removed
@@ -31,12 +45,10 @@ Older changelogs:
3145
[#812](https://github.com/ADOdb/ADOdb/issues/812)
3246
- firebird: undefined array key with uppercase columns
3347
[#813](https://github.com/ADOdb/ADOdb/issues/813)
34-
- mysqli: regression on setConnectionParameter()
48+
- mysql: regression on setConnectionParameter()
3549
[#803](https://github.com/ADOdb/ADOdb/issues/803)
36-
- mysqli: regression on bulk binding
50+
- mysql: regression on bulk binding
3751
[#806](https://github.com/ADOdb/ADOdb/issues/806)
38-
- mysqli: Affected_Rows() not returning correct value
39-
[#820](https://github.com/ADOdb/ADOdb/issues/820)
4052
- oci8: fix PHP 8.1 array deprecation warning
4153
[#817](https://github.com/ADOdb/ADOdb/issues/817)
4254
- memcache: weighted servers not connecting
@@ -1267,6 +1279,7 @@ Released together with [v4.95](changelog_v4.x.md#495---17-may-2007)
12671279
- Adodb5 version,more error checking code now will use exceptions if available.
12681280

12691281

1282+
[5.22.2]: https://github.com/adodb/adodb/compare/v5.22.1...v5.22.2
12701283
[5.22.1]: https://github.com/adodb/adodb/compare/v5.22.0...v5.22.1
12711284
[5.22.0]: https://github.com/adodb/adodb/compare/v5.21.4...v5.22.0
12721285

libraries/adodb/drivers/adodb-mssqlnative.inc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ function ServerInfo() {
151151

152152
$arrServerInfo = sqlsrv_server_info($this->_connectionID);
153153
$ADODB_FETCH_MODE = $savem;
154+
155+
$arr = array();
154156
$arr['description'] = $arrServerInfo['SQLServerName'].' connected to '.$arrServerInfo['CurrentDatabase'];
155157
$arr['version'] = $arrServerInfo['SQLServerVersion'];//ADOConnection::_findvers($arr['description']);
156158
return $arr;

libraries/adodb/drivers/adodb-mysqli.inc.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ public function execute($sql, $inputarr = false)
11121112
}
11131113
}
11141114

1115-
if ($inputarr === false) {
1115+
if ($inputarr === false || $inputarr === []) {
11161116
return $this->_execute($sql);
11171117
}
11181118

@@ -1314,18 +1314,13 @@ function _query($sql, $inputarr)
13141314
return false;
13151315
}
13161316

1317-
/*
1318-
* Is the statement a non-select
1319-
*/
1320-
if ($stmt->affected_rows > -1)
1321-
{
1317+
// Tells affected_rows to be compliant
1318+
$this->isSelectStatement = $stmt->affected_rows == -1;
1319+
if (!$this->isSelectStatement) {
13221320
$this->statementAffectedRows = $stmt->affected_rows;
13231321
return true;
13241322
}
13251323

1326-
// Tells affected_rows to be compliant
1327-
$this->isSelectStatement = true;
1328-
13291324
// Turn the statement into a result set and return it
13301325
return $stmt->get_result();
13311326
}

libraries/adodb/drivers/adodb-postgres64.inc.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ADODB_postgres64 extends ADOConnection{
2626
var $databaseType = 'postgres64';
2727
var $dataProvider = 'postgres';
2828
var $hasInsertID = true;
29-
/** @var bool|resource */
29+
/** @var PgSql\Connection|resource|false */
3030
var $_resultid = false;
3131
var $concat_operator='||';
3232
var $metaDatabasesSQL = "select datname from pg_database where datname not in ('template0','template1') order by 1";
@@ -155,15 +155,15 @@ function pg_insert_id($tablename,$fieldname)
155155
*/
156156
protected function _insertID($table = '', $column = '')
157157
{
158-
if (!is_resource($this->_resultid) || get_resource_type($this->_resultid) !== 'pgsql result') return false;
158+
if ($this->_resultid === false) return false;
159159
$oid = pg_last_oid($this->_resultid);
160160
// to really return the id, we need the table and column-name, else we can only return the oid != id
161161
return empty($table) || empty($column) ? $oid : $this->GetOne("SELECT $column FROM $table WHERE oid=".(int)$oid);
162162
}
163163

164164
function _affectedrows()
165165
{
166-
if (!is_resource($this->_resultid) || get_resource_type($this->_resultid) !== 'pgsql result') return false;
166+
if ($this->_resultid === false) return false;
167167
return pg_affected_rows($this->_resultid);
168168
}
169169

@@ -844,7 +844,7 @@ function _query($sql,$inputarr=false)
844844
}
845845
// check if no data returned, then no need to create real recordset
846846
if ($rez && pg_num_fields($rez) <= 0) {
847-
if (is_resource($this->_resultid) && get_resource_type($this->_resultid) === 'pgsql result') {
847+
if ($this->_resultid !== false) {
848848
pg_free_result($this->_resultid);
849849
}
850850
$this->_resultid = $rez;
@@ -1075,9 +1075,7 @@ function _fetch()
10751075

10761076
function _close()
10771077
{
1078-
if (!is_resource($this->_queryID)
1079-
|| get_resource_type($this->_queryID) != 'pgsql result'
1080-
) {
1078+
if ($this->_queryID === false) {
10811079
return true;
10821080
}
10831081
return pg_free_result($this->_queryID);

libraries/adodb/drivers/adodb-postgres7.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ function _query($sql,$inputarr=false)
231231
}
232232
// check if no data returned, then no need to create real recordset
233233
if ($rez && pg_num_fields($rez) <= 0) {
234-
if (is_resource($this->_resultid) && get_resource_type($this->_resultid) === 'pgsql result') {
234+
if ($this->_resultid !== false) {
235235
pg_free_result($this->_resultid);
236236
}
237237
$this->_resultid = $rez;

libraries/adodb/t-pdo.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
<?php
22
include 'adodb.inc.php';
33
include 'adodb-exceptions.inc.php';
4+
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
45

56
$u = 'root';
67
$p = 'C0yote71';
78

8-
$db = ADONewConnection('PDO');
9-
var_dump( $db->connect('mysql:dbname=bugtracker', $u, $p) );
9+
$driver = 'pdo\mysql';
10+
$driver = "mysql://$u:$p@localhost/bugtracker";
11+
$driver = "pdo\\mysql://$u:$p@localhost/bugtracker";
12+
//$driver = "pdo_mysql://$u:$p@localhost/bugtracker";
13+
//$driver = "pdo_mysql://$u:$p@localhost?dbname=bugtracker";
14+
15+
$db = ADONewConnection($driver) or die("New connection failed");
16+
//$db->connect('dbname=bugtracker', $u, $p) or die("Connect failed");
17+
echo "DB=$db->database, TYPE=$db->databaseType, PROVIDER=$db->dataProvider\n";
1018
$db->debug = true;
19+
print_r( $db->getarray('select id, summary from mantis_bug_table limit 1')[0] );
20+
1121

libraries/adodb/t.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,11 @@
88
$password = 'C0yote71';
99
$database = 'bugtracker';
1010

11-
$db = NewADOConnection($driver);
12-
13-
$db->memCache = true;
14-
$db->memCacheHost = array(
15-
array('host'=>'192.168.86.91','port'=>'11212','weight'=>70),
16-
array('host'=>'192.168.86.92','weight'=>30),
17-
);
18-
//$db->memCacheHost = array('192.168.86.91', '192.168.86.92');
19-
//$db->memCacheHost = [];
11+
$sql = "SELECT * FROM mantis_config_table";
2012

21-
$db->memCachePort = 11211;
22-
$db->memCacheCompress = false;
23-
$db->Connect($host,$user,$password,$database);
24-
25-
$sql = 'SELECT code,description FROM xref_table';
26-
$db->cacheExecute(2400,$sql);
13+
$db = NewADOConnection($driver);
14+
$db->connect($host, $user, $password, $database);
15+
$db->setFetchMode(ADODB_FETCH_ASSOC);
2716

17+
$q = $db->execute($sql, []);
18+
//print_r( $q->getAssoc() );

libraries/adodb/test-sqlsrv.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
* @link https://github.com/ADOdb/ADOdb Source code and issue tracker
1010
*
1111
* The ADOdb Library is dual-licensed, released under both the BSD 3-Clause
12-
* and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option,
12+
* and the GNU Lesser General Public Licence (LGPL) v5.22.2 2022-05-08 or, at your option,
1313
* any later version. This means you can use it in proprietary products.
1414
* See the LICENSE.md file distributed with this source code for details.
1515
* @license BSD-3-Clause
16-
* @license LGPL-2.1-or-later
16+
* @license LGPL-v5.22.2 2022-05-08-or-later
1717
*
1818
* @copyright 2000-2013 John Lim
1919
* @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community
@@ -28,11 +28,11 @@
2828
* @link https://github.com/ADOdb/ADOdb Source code and issue tracker
2929
*
3030
* The ADOdb Library is dual-licensed, released under both the BSD 3-Clause
31-
* and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option,
31+
* and the GNU Lesser General Public Licence (LGPL) v5.22.2 2022-05-08 or, at your option,
3232
* any later version. This means you can use it in proprietary products.
3333
* See the LICENSE.md file distributed with this source code for details.
3434
* @license BSD-3-Clause
35-
* @license LGPL-2.1-or-later
35+
* @license LGPL-v5.22.2 2022-05-08-or-later
3636
*
3737
* @copyright 2000-2013 John Lim
3838
* @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community
@@ -50,11 +50,11 @@
5050
* @link https://github.com/ADOdb/ADOdb Source code and issue tracker
5151
*
5252
* The ADOdb Library is dual-licensed, released under both the BSD 3-Clause
53-
* and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option,
53+
* and the GNU Lesser General Public Licence (LGPL) v5.22.2 2022-05-08 or, at your option,
5454
* any later version. This means you can use it in proprietary products.
5555
* See the LICENSE.md file distributed with this source code for details.
5656
* @license BSD-3-Clause
57-
* @license LGPL-2.1-or-later
57+
* @license LGPL-v5.22.2 2022-05-08-or-later
5858
*
5959
* @copyright 2000-2013 John Lim
6060
* @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community
@@ -72,11 +72,11 @@
7272
* @link https://github.com/ADOdb/ADOdb Source code and issue tracker
7373
*
7474
* The ADOdb Library is dual-licensed, released under both the BSD 3-Clause
75-
* and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option,
75+
* and the GNU Lesser General Public Licence (LGPL) v5.22.2 2022-05-08 or, at your option,
7676
* any later version. This means you can use it in proprietary products.
7777
* See the LICENSE.md file distributed with this source code for details.
7878
* @license BSD-3-Clause
79-
* @license LGPL-2.1-or-later
79+
* @license LGPL-v5.22.2 2022-05-08-or-later
8080
*
8181
* @copyright 2000-2013 John Lim
8282
* @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community

libraries/adodb/vendor/bin/phpunit

100644100755
File mode changed.

0 commit comments

Comments
 (0)