mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-58546 libraries: Patch ADOdb for PHP 7.2 compat
This commit is contained in:
parent
3fede79302
commit
acfb9df1a8
@ -520,7 +520,7 @@ class ADODB_DataDict {
|
||||
list($lines,$pkey,$idxs) = $this->_GenFields($flds);
|
||||
// genfields can return FALSE at times
|
||||
if ($lines == null) $lines = array();
|
||||
list(,$first) = each($lines);
|
||||
$first = current($lines);
|
||||
list(,$column_def) = preg_split("/[\t ]+/",$first,2);
|
||||
}
|
||||
return array(sprintf($this->renameColumn,$tabname,$this->NameQuote($oldcolumn),$this->NameQuote($newcolumn),$column_def));
|
||||
|
@ -111,7 +111,7 @@ function adodb_error_pg($errormsg)
|
||||
'could not serialize access due to' => DB_ERROR_SERIALIZATION_FAILURE
|
||||
);
|
||||
reset($error_regexps);
|
||||
while (list($regexp,$code) = each($error_regexps)) {
|
||||
foreach ($error_regexps as $regexp => $code) {
|
||||
if (preg_match("/$regexp/mi", $errormsg)) {
|
||||
return $code;
|
||||
}
|
||||
|
@ -1164,8 +1164,7 @@ if (!defined('_ADODB_LAYER')) {
|
||||
|
||||
foreach($inputarr as $arr) {
|
||||
$sql = ''; $i = 0;
|
||||
//Use each() instead of foreach to reduce memory usage -mikefedyk
|
||||
while(list(, $v) = each($arr)) {
|
||||
foreach ($arr as $v) {
|
||||
$sql .= $sqlarr[$i];
|
||||
// from Ron Baldwin <ron.baldwin#sourceprose.com>
|
||||
// Only quote string types
|
||||
|
@ -225,7 +225,7 @@ class ADODB_ado extends ADOConnection {
|
||||
|
||||
// Map by http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthcreateparam.asp
|
||||
// Check issue http://bugs.php.net/bug.php?id=40664 !!!
|
||||
while(list(, $val) = each($inputarr)) {
|
||||
foreach ($inputarr as $val) {
|
||||
$type = gettype($val);
|
||||
$len=strlen($val);
|
||||
if ($type == 'boolean')
|
||||
|
@ -248,7 +248,7 @@ class ADODB_ado extends ADOConnection {
|
||||
$oCmd->CommandText = $sql;
|
||||
$oCmd->CommandType = 1;
|
||||
|
||||
while(list(, $val) = each($inputarr)) {
|
||||
foreach ($inputarr as $val) {
|
||||
$type = gettype($val);
|
||||
$len=strlen($val);
|
||||
if ($type == 'boolean')
|
||||
|
@ -209,7 +209,7 @@ class ADODB_text extends ADOConnection {
|
||||
$where_arr = array();
|
||||
|
||||
reset($this->_origarray);
|
||||
while (list($k_arr,$arr) = each($this->_origarray)) {
|
||||
foreach ($this->_origarray as $arr) {
|
||||
|
||||
if ($i == 0 && $this->_skiprow1)
|
||||
$where_arr[] = $arr;
|
||||
@ -247,7 +247,7 @@ class ADODB_text extends ADOConnection {
|
||||
$i = 0;
|
||||
$n = '';
|
||||
reset($this->_colnames);
|
||||
while (list($k_n,$n) = each($this->_colnames)) {
|
||||
foreach ($this->_colnames as $n) {
|
||||
|
||||
if ($col == strtoupper(trim($n))) break;
|
||||
$i += 1;
|
||||
@ -302,7 +302,7 @@ class ADODB_text extends ADOConnection {
|
||||
if ($at == 0) {
|
||||
$i = 0;
|
||||
reset($projnames);
|
||||
while (list($k_n,$n) = each($projnames)) {
|
||||
foreach ($projnames as $n) {
|
||||
if (strtoupper(trim($n)) == $col) {
|
||||
$at = $i+1;
|
||||
break;
|
||||
|
@ -30,5 +30,7 @@ Our changes:
|
||||
* Removed random seed initialization from lib/adodb/adodb.inc.php:216 (see 038f546 and MDL-41198).
|
||||
* MDL-52286 Added muting erros in ADORecordSet::__destruct().
|
||||
Check if fixed upstream during the next upgrade and remove this note. (8638b3f1441d4b928)
|
||||
* MDL-58546 replaced each() with foreach for PHP 7.2 compatibility.
|
||||
pull request upstream: https://github.com/ADOdb/ADOdb/pull/373
|
||||
|
||||
skodak, iarenaza, moodler, stronk7, abgreeve, lameze, ankitagarwal
|
||||
skodak, iarenaza, moodler, stronk7, abgreeve, lameze, ankitagarwal, marinaglancy
|
||||
|
@ -77,7 +77,7 @@ function _adodb_export(&$rs,$sep,$sepreplace,$fp=false,$addtitles=true,$quote =
|
||||
reset($fieldTypes);
|
||||
$i = 0;
|
||||
$elements = array();
|
||||
while(list(,$o) = each($fieldTypes)) {
|
||||
foreach ($fieldTypes as $o) {
|
||||
|
||||
$v = ($o) ? $o->name : 'Field'.($i++);
|
||||
if ($escquote) $v = str_replace($quote,$escquotequote,$v);
|
||||
|
Loading…
x
Reference in New Issue
Block a user