|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36605 query with the named placeholders insert wrong data (PDO_OCI)
Submitted: 2006-03-03 15:02 UTC Modified: 2016-03-08 01:40 UTC
From: grzeh at mikronika dot pl Assigned:
Status: Not a bug Package: PDO OCI
PHP Version: 5.1.2 OS: GNU/Linux
Private report: No CVE-ID: None
 [2006-03-03 15:02 UTC] grzeh at mikronika dot pl
I have a problem in PDO extension (PDO_OCI driver) when I use 'insert' statement with the named placeholders. I insert two different strings into two fields. Execution of 'select'  statement returns one the same 'word' in two fields.

Similar problem I'h found in 'Select' statement with the named placeholders.

This 'bug' occured in PHP version greater then 5.1.0RC7-dev (snapshot 2005-11-21 07:30), where all works correctly. In versions 5.1.1, 5.1.2 and the latest (php5.1 2006-03-03 09:30) I have above errors.

I use --with-pdo-oci=instantclient,/usr, switch during compilation and I connect with Oracle server in 8.1.7 version. I run this test case under PDO_PGSQL driver and it works properly.

Reproduce code:
$x = new PDO("oci:dbname=xxx", 'scott', 'tiger');
$x->query("CREATE TABLE test(name VARCHAR2(100), value VARCHAR2(100))");
//insert statement:
$stmt = $x->prepare("INSERT INTO test (name, value) VALUES (:name, :value)");
$t = array(":name"=>"foo",":value"=>"bar");

//test select statement:
$row = $x->query("SELECT name, value FROM test");
print("name: ".$row["NAME"]." value:".$row["VALUE"]);

//'bindParam' version of 'insert' statement:
$stmt = $x->prepare("INSERT INTO test (name, value) VALUES (:name, :value)");
$stmt->bindParam(":name", $the_name, PDO::PARAM_STR, 32);
$stmt->bindParam(":value", $the_value, PDO::PARAM_STR, 32);
$the_name = "foo";
$the_value = "bar";

//select statement:
$stmt = $x->prepare("SELECT name, value FROM test WHERE name = :name AND value = :value");
$the_name = 'foo';
$the_value = 'bar';
if($row = $stmt->fetch())
   print "no rows";
if($row["NAME"]!=$the_name or $row["VALUE"]!=$the_value)
   print("Error: selected value is different from condition");

Expected result:
name: foo value: bar
    [NAME] => foo
    [0] => foo
    [VALUE] => bar
    [1] => bar

Actual result:
name: bar value: bar
"Segmentation fault" error
    [NAME] => bar
    [0] => bar
    [VALUE] => bar
    [1] => bar
Error: selected value is different from condition


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-06 14:44 UTC] developit at mail dot ru
just another incarnation of bug #36318
 [2006-03-06 14:48 UTC]
Dup of bug #36318.
 [2016-03-08 01:40 UTC]
-Package: PDO related +Package: PDO OCI
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 09:01:29 2024 UTC