MDL-52544 oracle: Apply upstream pull request to AdoDB oracle driver

Upstream: https://github.com/ADOdb/ADOdb/pull/259

Prevent segfault with ocipo driver on php7.

The OCIFetchinto function is causing segfaults on php7 - probably because the fields array
is not initialised or it is optimised out. This fixes just changes to use the safer function
oci_fetch_array instead.
This commit is contained in:
Damyon Wiese 2016-07-12 16:44:23 +08:00
parent eea2fc4319
commit 87c6f9ab23
2 changed files with 10 additions and 4 deletions

View File

@ -138,8 +138,10 @@ class ADORecordset_oci8po extends ADORecordset_oci8 {
// 10% speedup to move MoveNext to child class
function MoveNext()
{
if(@OCIfetchinto($this->_queryID,$this->fields,$this->fetchMode)) {
$ret = @oci_fetch_array($this->_queryID,$this->fetchMode);
if($ret !== false) {
global $ADODB_ANSI_PADDING_OFF;
$this->fields = $ret;
$this->_currentRow++;
$this->_updatefields();
@ -169,10 +171,12 @@ class ADORecordset_oci8po extends ADORecordset_oci8 {
$arr = array();
return $arr;
}
if (!@OCIfetchinto($this->_queryID,$this->fields,$this->fetchMode)) {
$ret = @oci_fetch_array($this->_queryID,$this->fetchMode);
if ($ret === false) {
$arr = array();
return $arr;
}
$this->fields = $ret;
$this->_updatefields();
$results = array();
$cnt = 0;
@ -188,8 +192,9 @@ class ADORecordset_oci8po extends ADORecordset_oci8 {
{
global $ADODB_ANSI_PADDING_OFF;
$ret = @OCIfetchinto($this->_queryID,$this->fields,$this->fetchMode);
$ret = @oci_fetch_array($this->_queryID,$this->fetchMode);
if ($ret) {
$this->fields = $ret;
$this->_updatefields();
if (!empty($ADODB_ANSI_PADDING_OFF)) {
@ -198,7 +203,7 @@ class ADORecordset_oci8po extends ADORecordset_oci8 {
}
}
}
return $ret;
return $ret !== false;
}
}

View File

@ -27,5 +27,6 @@ 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.
* MDL-52544 Pull upstream patch for php7 and ocipo.
skodak, iarenaza, moodler, stronk7, abgreeve