Bug #70302 [Fbk]: Parameter bind with OCI8 is broken - always last parameter value bound to all
| From: | sixd@php.net | Date: | Mon, 24 Aug 2015 07:52:39 +0000 |
| Subject: | Bug #70302 [Fbk]: Parameter bind with OCI8 is broken - always last parameter value bound to all | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-195459@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70302&edit=1
ID: 70302
Updated by: sixd@php.net
Reported by: deepdiver at owncloud dot com
Summary: Parameter bind with OCI8 is broken - always last
parameter value bound to all
Status: Feedback
Type: Bug
Package: OCI8 related
Operating System: Linux
PHP Version: 7.0.0beta3
Assigned To: sixd
Block user comment: N
Private report: N
New Comment:
You logged this with 7.0.0beta3. Can you test with master? The most recent OCI8 fixes did not get
into Beta3.
Previous Comments:
------------------------------------------------------------------------
[2015-08-23 23:08:27] sixd@php.net
Your non-failing, pure OCI8 testscript didn't use an array for A,B,C unlike the earlier code.
Try changing the OCI8 test to be closer to the original. And then review the test suites diffs to
see if the problem is related to one of the known test failures.
------------------------------------------------------------------------
[2015-08-20 08:55:52] deepdiver at owncloud dot com
Here is a pure OCI based script - which works \o/ - maybe a doctrine error then ....
<?php
function e($e) {
if (!$e) {
$e = oci_error();
var_dump($e);
exit;
}
}
$conn = oci_connect('autotest', 'owncloud', '172.17.0.1/XE');
e($conn);
// drop table
$stid = oci_parse($conn, 'DROP TABLE TEST');
e($stid);
$r = oci_execute($stid);
e($r);
// create
$stid = oci_parse($conn, 'CREATE TABLE TEST(A VARCHAR2(4000) NOT NULL, B VARCHAR2(4000) NOT
NULL, C VARCHAR2(4000) NOT NULL)');
e($stid);
$r = oci_execute($stid);
e($r);
// insert
$stid = oci_parse($conn, 'INSERT INTO TEST (A, B, C) VALUES(:a, :b, :c)');
e($stid);
$a = 1;
$b = 2;
$c = 3;
oci_bind_by_name($stid, ':a', $a);
oci_bind_by_name($stid, ':b', $b);
oci_bind_by_name($stid, ':c', $c);
$r = oci_execute($stid); // executes and commits
e($r);
// select
$stid = oci_parse($conn, 'SELECT * FROM TEST');
e($stid);
$r = oci_execute($stid); // executes and commits
e($r);
$data = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS);
var_dump($data);
------------------------------------------------------------------------
[2015-08-20 04:07:21] sixd@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
Your subject says "OCI", the category says "PDO_OCI" but the sample code
indicates you might mean OCI8.
Can you clarify and also supply a runnable testcase that doesn't depend on any 3rd party code?
If this is OCI8, is the problem related to one of the known diffs? Try running the test suite.
------------------------------------------------------------------------
[2015-08-19 12:33:03] deepdiver at owncloud dot com
Description:
------------
Query parameters are always bound to the value of the last parameter.
See the test script below.
Here is the out come with php 5.6:
$ php test.php
XDebug could not open the remote debug file '/tmp/xdebug.log'.
array(1) {
[0] =>
array(3) {
'A' =>
string(1) "1"
'B' =>
string(1) "2"
'C' =>
string(1) "3"
}
}
With 7.0.0beta3:
$ php --version
PHP 7.0.0beta3 (cli) (built: Aug 17 2015 17:19:56)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
deepdiver@alien:~/Development/ownCloud/php7-mysql$ php test.php
array(1) {
[0]=>
array(3) {
["A"]=>
string(1) "3"
["B"]=>
string(1) "3"
["C"]=>
string(1) "3"
}
}
Test script:
---------------
<?php
require 'vendor/autoload.php';
$config = new \Doctrine\DBAL\Configuration();
//..
$connectionParams = array(
'dbname' => 'XE',
'user' => 'autotest',
'password' => 'owncloud',
'host' => '10.0.0.7',
'port' => 1521,
'driver' => 'oci8',
);
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
$conn->connect();
$conn->executeUpdate('DROP TABLE TEST');
$conn->executeUpdate('CREATE TABLE TEST(A VARCHAR2(4000) NOT NULL, B VARCHAR2(4000) NOT
NULL, C VARCHAR2(4000) NOT NULL)');
$conn->insert('TEST', [
'A' => '1',
'B' => '2',
'C' => '3']);
$all = $conn->fetchAll('select * from TEST');
var_dump($all);
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70302&edit=1