PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #276

Bind variables do not work with oci8 calls.

Details

Submitted2003-11-19 22:21 UTC
Frommculey at jccc dot net
Assigneddanielc
StatusDuplicate
PackageDB
PHP Version4.3.3
OSLinux
Roadmaps(Not assigned)

Comments

[2003-11-19 22:21 UTC] mculey at jccc dot net

Description:
------------
Bind variables are ignored in the oci8 function calls resulting in no objects returned. The reason is the statement that is passed to the DB_result constructor is passed by value. This invalidates the statement. PHP returns this warning if the '@' is removed from line 205 of oci8.php:

PHP Warning: ocifetchinto(): 12 is not a valid OCI8-Statement resource in /opt/php-4.3.4/lib/php/DB/oci8.php on line 205

To fix the issue, we modified the DB_result constructor from this:
function DB_result(&$dbh, $result, $options = array())

to this:
function DB_result(&$dbh, &$result, $options = array())

Forcing the statement handle to be passed by value fixes the issue.

Reproduce code:
---------------
<?php
include_once('DB.php');

$db = DB::connect('oci8://scott:tiger@orcl');
$qry = $db->query('select * from dual where dummy = ?', array('X'));

$arr = $qry->fetchRow();
print_r($arr);

$qry->free();
$db->disconnect();

?>

Expected result:
----------------
Array
(
[0] => X
)

Actual result:
--------------
No output is generated. The oracle warnings are hidden due to the '@' in front of the OCIFetchInto call.