Commit f285ea55 authored by Steve Müller's avatar Steve Müller Committed by Marco Pivetta

keep references to bound parameter values in oci8 driver

Closes #2261
Closes #2262
Closes #2386
parent 9e1300bf
...@@ -71,6 +71,15 @@ class OCI8Statement implements \IteratorAggregate, Statement ...@@ -71,6 +71,15 @@ class OCI8Statement implements \IteratorAggregate, Statement
*/ */
protected $_paramMap = array(); protected $_paramMap = array();
/**
* Holds references to bound parameter values.
*
* This is a new requirement for PHP7's oci8 extension that prevents bound values from being garbage collected.
*
* @var array
*/
private $boundValues = array();
/** /**
* Creates a new OCI8Statement that uses the given connection handle and SQL statement. * Creates a new OCI8Statement that uses the given connection handle and SQL statement.
* *
...@@ -148,11 +157,17 @@ class OCI8Statement implements \IteratorAggregate, Statement ...@@ -148,11 +157,17 @@ class OCI8Statement implements \IteratorAggregate, Statement
$lob = oci_new_descriptor($this->_dbh, OCI_D_LOB); $lob = oci_new_descriptor($this->_dbh, OCI_D_LOB);
$lob->writeTemporary($variable, OCI_TEMP_BLOB); $lob->writeTemporary($variable, OCI_TEMP_BLOB);
$this->boundValues[$column] =& $lob;
return oci_bind_by_name($this->_sth, $column, $lob, -1, OCI_B_BLOB); return oci_bind_by_name($this->_sth, $column, $lob, -1, OCI_B_BLOB);
} elseif ($length !== null) { } elseif ($length !== null) {
$this->boundValues[$column] =& $variable;
return oci_bind_by_name($this->_sth, $column, $variable, $length); return oci_bind_by_name($this->_sth, $column, $variable, $length);
} }
$this->boundValues[$column] =& $variable;
return oci_bind_by_name($this->_sth, $column, $variable); return oci_bind_by_name($this->_sth, $column, $variable);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment