diff options
| author | Damien Regad <dregad@mantisbt.org> | 2023-11-18 16:54:21 +0100 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2024-05-26 16:21:27 +0200 |
| commit | bafc7737f056a07dcecc612ce2357a1fc2043dbb (patch) | |
| tree | a7cda66a51e855541aa80e013f9323e3d72e1eb5 | |
| parent | 5f589f64cea42c792929832cffe26825831f8c94 (diff) | |
| download | adodb-bafc7737f056a07dcecc612ce2357a1fc2043dbb.tar.gz adodb-bafc7737f056a07dcecc612ce2357a1fc2043dbb.tar.bz2 adodb-bafc7737f056a07dcecc612ce2357a1fc2043dbb.zip | |
oci8: fix warning in qStr() with NULL on PHP 8.1
This is a follow-up commit on 1501ccd07868d626a51802d14ed41ed05a3532ad,
as the original fix for #999 (see PR #1005) did not fully address the
problem. Another PHP deprecated warning is thrown:
strlen(): Passing null to parameter 1 ($string) of type string is
deprecated.
Fixes #1012
Backported from commit 8d88183538ae08b86c30af5b0f3280c2accd71c3.
| -rw-r--r-- | adodb-datadict.inc.php | 8 | ||||
| -rw-r--r-- | drivers/adodb-oci8.inc.php | 7 |
2 files changed, 8 insertions, 7 deletions
diff --git a/adodb-datadict.inc.php b/adodb-datadict.inc.php index 5156b1f9..b603d8de 100644 --- a/adodb-datadict.inc.php +++ b/adodb-datadict.inc.php @@ -1027,7 +1027,6 @@ class ADODB_DataDict { 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); @@ -1074,15 +1073,20 @@ class ADODB_DataDict { 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 --git a/drivers/adodb-oci8.inc.php b/drivers/adodb-oci8.inc.php index 965c1621..b92281c7 100644 --- a/drivers/adodb-oci8.inc.php +++ b/drivers/adodb-oci8.inc.php @@ -1576,11 +1576,8 @@ SELECT /*+ RULE */ distinct b.column_name */ 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); |
