ID: 36605 Comment by: developit at mail dot ru Reported By: grzeh at mikronika dot pl Status: Open Bug Type: PDO related Operating System: GNU/Linux PHP Version: 5.1.2 New Comment:
just another incarnation of bug #36318 Previous Comments: ------------------------------------------------------------------------ [2006-03-03 15:02:57] grzeh at mikronika dot pl Description: ------------ 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,10.1.0.3 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"); $stmt->execute($t); //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"; $stmt->execute(); //select statement: $stmt = $x->prepare("SELECT name, value FROM test WHERE name = :name AND value = :value"); $the_name = 'foo'; $the_value = 'bar'; $stmt->execute(array(":name"=>$the_name,":value"=>$the_value)); if($row = $stmt->fetch()) print_r($row); else print "no rows"; if($row["NAME"]!=$the_name or $row["VALUE"]!=$the_value) { print("Error: selected value is different from condition"); } else { print("OK"); } Expected result: ---------------- name: foo value: bar Array ( [NAME] => foo [0] => foo [VALUE] => bar [1] => bar ) OK Actual result: -------------- name: bar value: bar "Segmentation fault" error Array ( [NAME] => bar [0] => bar [VALUE] => bar [1] => bar ) Error: selected value is different from condition ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36605&edit=1