Skip to content

Commit

Permalink
Merge branch 'hotfix/#2434-#2261-#2262-#2386-keep-bound-oci8-paramete…
Browse files Browse the repository at this point in the history
…rs-from-gc'

Close #2434
Close #2261
Close #2262
Close #2386
  • Loading branch information
Ocramius committed Jul 7, 2016
2 parents 8e8c5a1 + ae314b1 commit 69b5785
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ class OCI8Statement implements \IteratorAggregate, Statement
*/
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.
*
Expand Down Expand Up @@ -148,11 +157,17 @@ public function bindParam($column, &$variable, $type = null, $length = null)
$lob = oci_new_descriptor($this->_dbh, OCI_D_LOB);
$lob->writeTemporary($variable, OCI_TEMP_BLOB);

$this->boundValues[$column] =& $lob;

return oci_bind_by_name($this->_sth, $column, $lob, -1, OCI_B_BLOB);
} elseif ($length !== null) {
$this->boundValues[$column] =& $variable;

return oci_bind_by_name($this->_sth, $column, $variable, $length);
}

$this->boundValues[$column] =& $variable;

return oci_bind_by_name($this->_sth, $column, $variable);
}

Expand Down

0 comments on commit 69b5785

Please sign in to comment.