]> granicus.if.org Git - php/commitdiff
Fix #51220 by adding . Also improve reliability for tests using undefined behavior.
authorChristopher Jones <sixd@php.net>
Fri, 26 Mar 2010 19:38:26 +0000 (19:38 +0000)
committerChristopher Jones <sixd@php.net>
Fri, 26 Mar 2010 19:38:26 +0000 (19:38 +0000)
24 files changed:
ext/oci8/tests/bind_char_1.phpt
ext/oci8/tests/bind_char_1_11gR1.phpt [new file with mode: 0644]
ext/oci8/tests/bind_char_2.phpt
ext/oci8/tests/bind_char_2_11gR1.phpt [new file with mode: 0644]
ext/oci8/tests/bind_char_3.phpt
ext/oci8/tests/bind_char_3_11gR1.phpt [new file with mode: 0644]
ext/oci8/tests/bind_char_4.phpt
ext/oci8/tests/bind_char_4_11gR1.phpt [new file with mode: 0644]
ext/oci8/tests/bind_long.phpt
ext/oci8/tests/bug27303_1.phpt [new file with mode: 0644]
ext/oci8/tests/bug27303_1_11gR1.phpt [moved from ext/oci8/tests/bug27303.phpt with 92% similarity]
ext/oci8/tests/bug27303_2.phpt
ext/oci8/tests/bug27303_2_11gR1.phpt [new file with mode: 0644]
ext/oci8/tests/bug27303_3.phpt
ext/oci8/tests/bug27303_4.phpt
ext/oci8/tests/bug27303_4_11gR1.phpt [new file with mode: 0644]
ext/oci8/tests/bug44113.phpt
ext/oci8/tests/commit_002.phpt
ext/oci8/tests/conn_attr_4.phpt
ext/oci8/tests/details.inc
ext/oci8/tests/extauth_01.phpt
ext/oci8/tests/extauth_02.phpt
ext/oci8/tests/extauth_03.phpt
ext/oci8/tests/lob_043.phpt

index 36574dbfbb12b1bf1526de25d8bd3ea627cfedb9..71cccbfc50ad583573e22a9811b6e81c6e28d7f2 100644 (file)
@@ -5,14 +5,17 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
 $sv = oci_server_version($c);
-$sv = preg_match('/Release 1[12]\./', $sv, $matches);
+$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
 if ($sv !== 1) {
-       die ("skip expected output only valid when using Oracle 11g+ database");
+       die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
 }
 ?>
 --FILE--
 <?php
 
+// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs.
+// It will diff on the undefined cases with a 32bit 11.2.0.1 DB
+
 require(dirname(__FILE__).'/connect.inc');
 
 // Initialization
@@ -219,7 +222,9 @@ Test 1.2: Type: AFC.  Length: default
     ::
 Test 1.3: Type: AFC:  Length: 0
   Querying:
-    Oci_execute error ORA-1460 Exiting Query
+    :1:
+    :abc       :
+    ::
 Test 1.4: Type: AFC:  Length: strlen
   Querying:
     :1:
@@ -227,7 +232,9 @@ Test 1.4: Type: AFC:  Length: strlen
     ::
 Test 1.5: Type: AFC.  Length: strlen-1
   Querying:
-    Oci_execute error ORA-1460 Exiting Query
+    :1:
+    :abc       :
+    ::
 Test 1.6: Type: AFC.  Length: strlen+1
   Querying:
     :1:
@@ -263,7 +270,9 @@ Test 3.2: Type: AFC.  Length: default
     :abc:
 Test 3.3: Type: AFC:  Length: 0
   Querying:
-    Oci_execute error ORA-1460 Exiting Query
+    :2:
+    ::
+    :abc:
 Test 3.4: Type: AFC:  Length: strlen
   Querying:
     :2:
@@ -271,7 +280,9 @@ Test 3.4: Type: AFC:  Length: strlen
     :abc:
 Test 3.5: Type: AFC.  Length: strlen-1
   Querying:
-    Oci_execute error ORA-1460 Exiting Query
+    :2:
+    ::
+    :abc:
 Test 3.6: Type: AFC.  Length: strlen+1
   Querying:
     :2:
diff --git a/ext/oci8/tests/bind_char_1_11gR1.phpt b/ext/oci8/tests/bind_char_1_11gR1.phpt
new file mode 100644 (file)
index 0000000..60b7142
--- /dev/null
@@ -0,0 +1,297 @@
+--TEST--
+SELECT oci_bind_by_name with SQLT_AFC aka CHAR
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+require(dirname(__FILE__)."/connect.inc");
+$sv = oci_server_version($c);
+$sv = preg_match('/Release 11\.1\./', $sv, $matches);
+if ($sv !== 1) {
+       die ("skip expected output only valid when using Oracle 11gR1 database");
+}
+?>
+--FILE--
+<?php
+
+// Output is for 32 bit client to 64bit 11.1.0.6
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+       "drop table bind_char_tab",
+       "create table bind_char_tab (id number, c1 char(10), c2 varchar2(10))",
+       "insert into bind_char_tab values (1, 'abc', NULL)",
+       "insert into bind_char_tab values (2, NULL, 'abc')",
+       "insert into bind_char_tab values (3, NULL, 'abc       ')"
+);
+                                                
+foreach ($stmtarray as $stmt) {
+       $s = oci_parse($c, $stmt);
+       @oci_execute($s);
+}
+
+// Run Test
+
+echo "*** Non-null Data Tests against CHAR***\n";
+
+$bv1 = 'abc';
+
+echo "Test 1.1: Type: default.  Length: default\n";
+$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv");
+$r = oci_bind_by_name($s, ":bv", $bv1);
+if ($r)
+       do_e_q($s);
+
+echo "Test 1.2: Type: AFC.  Length: default\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 1.3: Type: AFC:  Length: 0\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 1.4: Type: AFC:  Length: strlen\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 1.5: Type: AFC.  Length: strlen-1\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 1.6: Type: AFC.  Length: strlen+1\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "\n\n*** NULL data tests against CHAR ***\n";
+
+$bv1 = null;
+
+echo "Test 2.1: Type: default.  Length: default\n";
+$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv");
+$r = oci_bind_by_name($s, ":bv", $bv1);
+if ($r)
+       do_e_q($s);
+
+echo "Test 2.2: Type: AFC.  Length: default\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 2.3: Type: AFC:  Length: 0\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 2.4: Type: AFC:  Length: strlen\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 2.5: Type: AFC.  Length: strlen-1\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 2.6: Type: AFC.  Length: strlen+1\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+
+echo "\n\n*** Non-null Data Tests against VARCHAR2***\n";
+
+$bv1 = 'abc';
+
+echo "Test 3.1: Type: default.  Length: default\n";
+$s = oci_parse($c, "select * from bind_char_tab where c2 = :bv");
+$r = oci_bind_by_name($s, ":bv", $bv1);
+if ($r)
+       do_e_q($s);
+
+echo "Test 3.2: Type: AFC.  Length: default\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 3.3: Type: AFC:  Length: 0\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 3.4: Type: AFC:  Length: strlen\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 3.5: Type: AFC.  Length: strlen-1\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 3.6: Type: AFC.  Length: strlen+1\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+
+echo "\n\n*** NULL data tests against VARCHAR2 ***\n";
+
+$bv1 = null;
+
+echo "Test 4.1: Type: default.  Length: default\n";
+$s = oci_parse($c, "select * from bind_char_tab where c2 = :bv");
+$r = oci_bind_by_name($s, ":bv", $bv1);
+if ($r)
+       do_e_q($s);
+
+echo "Test 4.2: Type: AFC.  Length: default\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 4.3: Type: AFC:  Length: 0\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 4.4: Type: AFC:  Length: strlen\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 4.5: Type: AFC.  Length: strlen-1\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 4.6: Type: AFC.  Length: strlen+1\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+
+
+function do_e_q($s)
+{
+       echo "  Querying:\n";
+
+       $r = @oci_execute($s);
+       if (!$r) {
+               $m = oci_error($s);
+               echo "    Oci_execute error ORA-".$m['code']." Exiting Query\n";
+               return;
+       }
+       while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
+               foreach ($row as $item) {
+                       echo "    :" . $item . ":\n";
+               }
+       }
+}
+
+// Cleanup
+$stmtarray = array(
+       "drop table bind_char_tab"
+);
+                                                
+foreach ($stmtarray as $stmt) {
+       $s = oci_parse($c, $stmt);
+       oci_execute($s);
+}
+
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECT--
+*** Non-null Data Tests against CHAR***
+Test 1.1: Type: default.  Length: default
+  Querying:
+Test 1.2: Type: AFC.  Length: default
+  Querying:
+    :1:
+    :abc       :
+    ::
+Test 1.3: Type: AFC:  Length: 0
+  Querying:
+    Oci_execute error ORA-1460 Exiting Query
+Test 1.4: Type: AFC:  Length: strlen
+  Querying:
+    :1:
+    :abc       :
+    ::
+Test 1.5: Type: AFC.  Length: strlen-1
+  Querying:
+    Oci_execute error ORA-1460 Exiting Query
+Test 1.6: Type: AFC.  Length: strlen+1
+  Querying:
+    :1:
+    :abc       :
+    ::
+
+
+*** NULL data tests against CHAR ***
+Test 2.1: Type: default.  Length: default
+  Querying:
+Test 2.2: Type: AFC.  Length: default
+  Querying:
+Test 2.3: Type: AFC:  Length: 0
+  Querying:
+Test 2.4: Type: AFC:  Length: strlen
+  Querying:
+Test 2.5: Type: AFC.  Length: strlen-1
+  Querying:
+Test 2.6: Type: AFC.  Length: strlen+1
+  Querying:
+
+
+*** Non-null Data Tests against VARCHAR2***
+Test 3.1: Type: default.  Length: default
+  Querying:
+    :2:
+    ::
+    :abc:
+Test 3.2: Type: AFC.  Length: default
+  Querying:
+    :2:
+    ::
+    :abc:
+Test 3.3: Type: AFC:  Length: 0
+  Querying:
+    Oci_execute error ORA-1460 Exiting Query
+Test 3.4: Type: AFC:  Length: strlen
+  Querying:
+    :2:
+    ::
+    :abc:
+Test 3.5: Type: AFC.  Length: strlen-1
+  Querying:
+    Oci_execute error ORA-1460 Exiting Query
+Test 3.6: Type: AFC.  Length: strlen+1
+  Querying:
+    :2:
+    ::
+    :abc:
+
+
+*** NULL data tests against VARCHAR2 ***
+Test 4.1: Type: default.  Length: default
+  Querying:
+Test 4.2: Type: AFC.  Length: default
+  Querying:
+Test 4.3: Type: AFC:  Length: 0
+  Querying:
+Test 4.4: Type: AFC:  Length: strlen
+  Querying:
+Test 4.5: Type: AFC.  Length: strlen-1
+  Querying:
+Test 4.6: Type: AFC.  Length: strlen+1
+  Querying:
+Done
index f0f41663f57aa2b6d95d2894d2808940a255afe1..6c7dbafcc5414e681a76b1f28f696360a89d7a6e 100644 (file)
@@ -5,14 +5,17 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
 $sv = oci_server_version($c);
-$sv = preg_match('/Release 1[12]\./', $sv, $matches);
+$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
 if ($sv !== 1) {
-       die ("skip expected output only valid when using Oracle 11g+ database");
+       die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
 }
 ?>
 --FILE--
 <?php
 
+// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs.
+// It will diff on the undefined cases with a 32bit 11.2.0.1 DB
+
 require(dirname(__FILE__).'/connect.inc');
 
 // Initialization
@@ -115,7 +118,8 @@ Test 1.4: Type: AFC:  Length: strlen
     :2008-04-20:
 Test 1.5: Type: AFC.  Length: strlen-1
   Querying:
-    Oci_execute error ORA-1460 Exiting Query
+    :1:
+    :2008-04-20:
 Test 1.6: Type: AFC.  Length: strlen+1
   Querying:
     :1:
diff --git a/ext/oci8/tests/bind_char_2_11gR1.phpt b/ext/oci8/tests/bind_char_2_11gR1.phpt
new file mode 100644 (file)
index 0000000..68a872f
--- /dev/null
@@ -0,0 +1,123 @@
+--TEST--
+SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+require(dirname(__FILE__)."/connect.inc");
+$sv = oci_server_version($c);
+$sv = preg_match('/Release 11\.1\./', $sv, $matches);
+if ($sv !== 1) {
+       die ("skip expected output only valid when using Oracle 11gR1 database");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+       "alter session set nls_date_format='YYYY-MM-DD'",
+       "drop table bind_char_tab",
+       "create table bind_char_tab (id number, c1 date)",
+       "insert into bind_char_tab values (1, '2008-04-20')",
+);
+                                                
+foreach ($stmtarray as $stmt) {
+       $s = oci_parse($c, $stmt);
+       @oci_execute($s);
+}
+
+// Run Test
+
+$bv1 = '2008-04-20';
+
+echo "Test 1.1: Type: default.  Length: default\n";
+$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv");
+$r = oci_bind_by_name($s, ":bv", $bv1);
+if ($r)
+   do_e_q($s);
+
+echo "Test 1.2: Type: AFC.  Length: default\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 1.3: Type: AFC:  Length: 0\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 1.4: Type: AFC:  Length: strlen\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 1.5: Type: AFC.  Length: strlen-1\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+echo "Test 1.6: Type: AFC.  Length: strlen+1\n";
+$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
+if ($r)
+       do_e_q($s);
+
+
+function do_e_q($s)
+{
+       echo "  Querying:\n";
+
+       $r = @oci_execute($s);
+       if (!$r) {
+               $m = oci_error($s);
+               echo "    Oci_execute error ORA-".$m['code']." Exiting Query\n";
+               return;
+       }
+       while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
+               foreach ($row as $item) {
+                       echo "    :" . $item . ":\n";
+               }
+       }
+}
+
+// Cleanup
+$stmtarray = array(
+       "drop table bind_char_tab"
+);
+                                                
+foreach ($stmtarray as $stmt) {
+       $s = oci_parse($c, $stmt);
+       oci_execute($s);
+}
+
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Test 1.1: Type: default.  Length: default
+  Querying:
+    :1:
+    :2008-04-20:
+Test 1.2: Type: AFC.  Length: default
+  Querying:
+    :1:
+    :2008-04-20:
+Test 1.3: Type: AFC:  Length: 0
+  Querying:
+    Oci_execute error ORA-1460 Exiting Query
+Test 1.4: Type: AFC:  Length: strlen
+  Querying:
+    :1:
+    :2008-04-20:
+Test 1.5: Type: AFC.  Length: strlen-1
+  Querying:
+    Oci_execute error ORA-1460 Exiting Query
+Test 1.6: Type: AFC.  Length: strlen+1
+  Querying:
+    :1:
+    :2008-04-20:
+Done
index 6d1b31150f9acd7700ef009c10e65354c0f046a5..8d4e95f6bf677e31f7241ec7a6d862936e9ccb53 100644 (file)
@@ -5,14 +5,17 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
 $sv = oci_server_version($c);
-$sv = preg_match('/Release 1[12]\./', $sv, $matches);
+$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
 if ($sv !== 1) {
-       die ("skip expected output only valid when using Oracle 11g+ database");
+       die ("skip expected output only valid when using Oracle 10gR2 11gR2 databases");
 }
 ?>
 --FILE--
 <?php
 
+// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs.
+// It will diff on the undefined cases with a 32bit 11.2.0.1 DB
+
 require(dirname(__FILE__).'/connect.inc');
 
 // Initialization
@@ -254,9 +257,8 @@ echo "Done\n";
 --EXPECTF--
 Test 1.1 In Length: default.  In Type: default.  Out Length: default.          Out Type: default
   Executing:
-    Oci_execute error ORA-6502
 string(3) "abc"
-NULL
+string(3) "abc"
 Test 1.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default
   Executing:
 string(3) "abc"
@@ -268,20 +270,19 @@ string(3) "abc"
 Test 1.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
   Executing:
 string(3) "abc"
-string(10) "abc       "
+string(30) "abc                           "
 Test 1.5 In Length: strlen.   In Type: AFC.      Out Length: strlen(input).    Out Type: AFC
   Executing:
 string(3) "abc"
-string(3) "abc"
+string(9) "abc      "
 Test 1.6 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)-1.  Out Type: AFC
   Executing:
-    Oci_execute error ORA-6502
-string(3) "abc"
 string(3) "abc"
+string(6) "abc   "
 Test 1.7 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)+1.  Out Type: AFC
   Executing:
 string(3) "abc"
-string(4) "abc "
+string(12) "abc         "
 
 
 Tests with ''
diff --git a/ext/oci8/tests/bind_char_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt
new file mode 100644 (file)
index 0000000..aaa5371
--- /dev/null
@@ -0,0 +1,344 @@
+--TEST--
+PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+require(dirname(__FILE__)."/connect.inc");
+$sv = oci_server_version($c);
+$sv = preg_match('/Release 11\.1\./', $sv, $matches);
+if ($sv !== 1) {
+       die ("skip expected output only valid when using Oracle 11gR1 database");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+       "create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
+);
+                                                
+foreach ($stmtarray as $stmt) {
+       $s = oci_parse($c, $stmt);
+       @oci_execute($s);
+}
+
+// Run Test
+
+echo "Test 1.1 In Length: default.  In Type: default.  Out Length: default.          Out Type: default\n";
+
+$s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;");
+$bv1 = 'abc';
+$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+echo "Test 1.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default\n";
+
+$bv1 = 'abc';
+$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "Test 1.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default\n";
+
+$bv1 = 'abc';
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 1.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
+
+$bv1 = 'abc';
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "Test 1.5 In Length: strlen.   In Type: AFC.      Out Length: strlen(input).    Out Type: AFC\n";
+
+$bv1 = 'abc';
+$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "Test 1.6 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)-1.  Out Type: AFC\n";
+
+$bv1 = 'abc';
+$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "Test 1.7 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)+1.  Out Type: AFC\n";
+
+$bv1 = 'abc';
+$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "\n\nTests with ''\n\n";
+
+echo "Test 2.1 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
+
+$bv1 = '';
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "Test 2.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default\n";
+
+$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 2.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default\n";
+
+$bv1 = '';
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 2.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
+
+$bv1 = '';
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 2.5 In Length: -1.       In Type: AFC.      Out Length: 0.                Out Type: AFC\n";
+
+$bv1 = '';
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 2.6 In Length: 0.        In Type: AFC.      Out Length: 0.                Out Type: AFC\n";
+
+$bv1 = '';
+$r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 2.7 In Length: 1.        In Type: AFC.      Out Length: 1.                Out Type: AFC\n";
+
+$bv1 = '';
+$r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "\n\nTests with NULL\n";
+
+echo "Test 3.1 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
+
+$bv1 = null;
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "Test 3.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default\n";
+
+$bv1 = null;
+$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 3.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default\n";
+
+$bv1 = null;
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 3.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
+
+$bv1 = null;
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "Test 3.5 In Length: -1.       In Type: AFC.      Out Length: 0.                Out Type: AFC\n";
+
+$bv1 = null;
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 3.6 In Length: -1.       In Type: AFC.      Out Length: 1.                Out Type: AFC\n";
+
+$bv1 = null;
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+function do_e($s)
+{
+       echo "  Executing:\n";
+
+       $r = @oci_execute($s);
+       if (!$r) {
+               $m = oci_error($s);
+               echo "    Oci_execute error ORA-".$m['code']."\n";
+               return;
+       }
+}
+
+// Cleanup
+
+//require(dirname(__FILE__).'/drop_table.inc');
+
+$stmtarray = array(
+       "drop function bind_char_3_fn"
+);
+
+foreach ($stmtarray as $stmt) {
+       $s = oci_parse($c, $stmt);
+       oci_execute($s);
+}
+
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1.1 In Length: default.  In Type: default.  Out Length: default.          Out Type: default
+  Executing:
+    Oci_execute error ORA-6502
+string(3) "abc"
+NULL
+Test 1.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default
+  Executing:
+string(3) "abc"
+string(3) "abc"
+Test 1.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default
+  Executing:
+string(3) "abc"
+string(3) "abc"
+Test 1.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
+  Executing:
+string(3) "abc"
+string(10) "abc       "
+Test 1.5 In Length: strlen.   In Type: AFC.      Out Length: strlen(input).    Out Type: AFC
+  Executing:
+string(3) "abc"
+string(3) "abc"
+Test 1.6 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)-1.  Out Type: AFC
+  Executing:
+    Oci_execute error ORA-6502
+string(3) "abc"
+string(3) "abc"
+Test 1.7 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)+1.  Out Type: AFC
+  Executing:
+string(3) "abc"
+string(4) "abc "
+
+
+Tests with ''
+
+Test 2.1 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
+  Executing:
+string(0) ""
+NULL
+Test 2.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default
+  Executing:
+string(0) ""
+NULL
+Test 2.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default
+  Executing:
+string(0) ""
+NULL
+Test 2.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
+  Executing:
+string(0) ""
+NULL
+Test 2.5 In Length: -1.       In Type: AFC.      Out Length: 0.                Out Type: AFC
+  Executing:
+string(0) ""
+NULL
+Test 2.6 In Length: 0.        In Type: AFC.      Out Length: 0.                Out Type: AFC
+  Executing:
+string(0) ""
+NULL
+Test 2.7 In Length: 1.        In Type: AFC.      Out Length: 1.                Out Type: AFC
+  Executing:
+string(0) ""
+NULL
+
+
+Tests with NULL
+Test 3.1 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
+  Executing:
+NULL
+NULL
+Test 3.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default
+  Executing:
+NULL
+NULL
+Test 3.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default
+  Executing:
+NULL
+NULL
+Test 3.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
+  Executing:
+NULL
+NULL
+Test 3.5 In Length: -1.       In Type: AFC.      Out Length: 0.                Out Type: AFC
+  Executing:
+NULL
+NULL
+Test 3.6 In Length: -1.       In Type: AFC.      Out Length: 1.                Out Type: AFC
+  Executing:
+NULL
+NULL
+Done
index 7377604b0cd713b4bf58f112cbbfedaaf2cf22ba..40221b266f52bdd89a6fce8601dd9a315a7330c8 100644 (file)
@@ -5,14 +5,17 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
 $sv = oci_server_version($c);
-$sv = preg_match('/Release 1[12]\./', $sv, $matches);
+$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
 if ($sv !== 1) {
-       die ("skip expected output only valid when using Oracle 11g+ database");
+       die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
 }
 ?>
 --FILE--
 <?php
 
+// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs.
+// It will diff on the undefined cases with a 32bit 11.2.0.1 DB
+
 // Same test as bind_char_3 but the PL/SQL function uses VARCHAR2 instead of CHAR
 
 require(dirname(__FILE__).'/connect.inc');
@@ -256,9 +259,8 @@ echo "Done\n";
 --EXPECTF--
 Test 1.1 In Length: default.  In Type: default.  Out Length: default.          Out Type: default
   Executing:
-    Oci_execute error ORA-6502
 string(3) "abc"
-NULL
+string(3) "abc"
 Test 1.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default
   Executing:
 string(3) "abc"
@@ -270,20 +272,19 @@ string(3) "abc"
 Test 1.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
   Executing:
 string(3) "abc"
-string(10) "abc       "
+string(30) "abc                           "
 Test 1.5 In Length: strlen.   In Type: AFC.      Out Length: strlen(input).    Out Type: AFC
   Executing:
 string(3) "abc"
-string(3) "abc"
+string(9) "abc      "
 Test 1.6 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)-1.  Out Type: AFC
   Executing:
-    Oci_execute error ORA-6502
-string(3) "abc"
 string(3) "abc"
+string(6) "abc   "
 Test 1.7 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)+1.  Out Type: AFC
   Executing:
 string(3) "abc"
-string(4) "abc "
+string(12) "abc         "
 
 
 Tests with ''
diff --git a/ext/oci8/tests/bind_char_4_11gR1.phpt b/ext/oci8/tests/bind_char_4_11gR1.phpt
new file mode 100644 (file)
index 0000000..c4f7968
--- /dev/null
@@ -0,0 +1,346 @@
+--TEST--
+PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+require(dirname(__FILE__)."/connect.inc");
+$sv = oci_server_version($c);
+$sv = preg_match('/Release 11\.1\./', $sv, $matches);
+if ($sv !== 1) {
+       die ("skip expected output only valid when using Oracle 11gR1 database");
+}
+?>
+--FILE--
+<?php
+
+// Same test as bind_char_3 but the PL/SQL function uses VARCHAR2 instead of CHAR
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+       "create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
+);
+                                                
+foreach ($stmtarray as $stmt) {
+       $s = oci_parse($c, $stmt);
+       @oci_execute($s);
+}
+
+// Run Test
+
+echo "Test 1.1 In Length: default.  In Type: default.  Out Length: default.          Out Type: default\n";
+
+$s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;");
+$bv1 = 'abc';
+$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+echo "Test 1.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default\n";
+
+$bv1 = 'abc';
+$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "Test 1.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default\n";
+
+$bv1 = 'abc';
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 1.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
+
+$bv1 = 'abc';
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "Test 1.5 In Length: strlen.   In Type: AFC.      Out Length: strlen(input).    Out Type: AFC\n";
+
+$bv1 = 'abc';
+$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "Test 1.6 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)-1.  Out Type: AFC\n";
+
+$bv1 = 'abc';
+$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "Test 1.7 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)+1.  Out Type: AFC\n";
+
+$bv1 = 'abc';
+$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "\n\nTests with ''\n\n";
+
+echo "Test 2.1 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
+
+$bv1 = '';
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "Test 2.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default\n";
+
+$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 2.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default\n";
+
+$bv1 = '';
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 2.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
+
+$bv1 = '';
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 2.5 In Length: -1.       In Type: AFC.      Out Length: 0.                Out Type: AFC\n";
+
+$bv1 = '';
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 2.6 In Length: 0.        In Type: AFC.      Out Length: 0.                Out Type: AFC\n";
+
+$bv1 = '';
+$r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 2.7 In Length: 1.        In Type: AFC.      Out Length: 1.                Out Type: AFC\n";
+
+$bv1 = '';
+$r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "\n\nTests with NULL\n";
+
+echo "Test 3.1 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
+
+$bv1 = null;
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "Test 3.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default\n";
+
+$bv1 = null;
+$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 3.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default\n";
+
+$bv1 = null;
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 3.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
+
+$bv1 = null;
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+echo "Test 3.5 In Length: -1.       In Type: AFC.      Out Length: 0.                Out Type: AFC\n";
+
+$bv1 = null;
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+
+echo "Test 3.6 In Length: -1.       In Type: AFC.      Out Length: 1.                Out Type: AFC\n";
+
+$bv1 = null;
+$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
+if ($r)
+       do_e($s);
+var_dump($bv1, $bv2);
+
+
+function do_e($s)
+{
+       echo "  Executing:\n";
+
+       $r = @oci_execute($s);
+       if (!$r) {
+               $m = oci_error($s);
+               echo "    Oci_execute error ORA-".$m['code']."\n";
+               return;
+       }
+}
+
+// Cleanup
+
+//require(dirname(__FILE__).'/drop_table.inc');
+
+$stmtarray = array(
+       "drop function bind_char_3_fn"
+);
+
+foreach ($stmtarray as $stmt) {
+       $s = oci_parse($c, $stmt);
+       oci_execute($s);
+}
+
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1.1 In Length: default.  In Type: default.  Out Length: default.          Out Type: default
+  Executing:
+    Oci_execute error ORA-6502
+string(3) "abc"
+NULL
+Test 1.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default
+  Executing:
+string(3) "abc"
+string(3) "abc"
+Test 1.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default
+  Executing:
+string(3) "abc"
+string(3) "abc"
+Test 1.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
+  Executing:
+string(3) "abc"
+string(10) "abc       "
+Test 1.5 In Length: strlen.   In Type: AFC.      Out Length: strlen(input).    Out Type: AFC
+  Executing:
+string(3) "abc"
+string(3) "abc"
+Test 1.6 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)-1.  Out Type: AFC
+  Executing:
+    Oci_execute error ORA-6502
+string(3) "abc"
+string(3) "abc"
+Test 1.7 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)+1.  Out Type: AFC
+  Executing:
+string(3) "abc"
+string(4) "abc "
+
+
+Tests with ''
+
+Test 2.1 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
+  Executing:
+string(0) ""
+NULL
+Test 2.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default
+  Executing:
+string(0) ""
+NULL
+Test 2.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default
+  Executing:
+string(0) ""
+NULL
+Test 2.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
+  Executing:
+string(0) ""
+NULL
+Test 2.5 In Length: -1.       In Type: AFC.      Out Length: 0.                Out Type: AFC
+  Executing:
+string(0) ""
+NULL
+Test 2.6 In Length: 0.        In Type: AFC.      Out Length: 0.                Out Type: AFC
+  Executing:
+string(0) ""
+NULL
+Test 2.7 In Length: 1.        In Type: AFC.      Out Length: 1.                Out Type: AFC
+  Executing:
+string(0) ""
+NULL
+
+
+Tests with NULL
+Test 3.1 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
+  Executing:
+NULL
+NULL
+Test 3.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default
+  Executing:
+NULL
+NULL
+Test 3.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default
+  Executing:
+NULL
+NULL
+Test 3.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
+  Executing:
+NULL
+NULL
+Test 3.5 In Length: -1.       In Type: AFC.      Out Length: 0.                Out Type: AFC
+  Executing:
+NULL
+NULL
+Test 3.6 In Length: -1.       In Type: AFC.      Out Length: 1.                Out Type: AFC
+  Executing:
+NULL
+NULL
+Done
index 065a5f1439c1f542da197beb9eb207b21699eaad..ba6bd4d044375f1e01d1605c2e17bb933f356c30 100644 (file)
@@ -5,7 +5,10 @@ bind LONG field
 --FILE--
 <?php
 
-require dirname(__FILE__)."/connect.inc";
+require(dirname(__FILE__)."/connect.inc");
+
+$stmt = oci_parse($c, "drop table phptestlng");
+@oci_execute($stmt);
 
 $stmt = oci_parse($c, "create table phptestlng( id number(10), filetxt long)");
 oci_execute($stmt);
diff --git a/ext/oci8/tests/bug27303_1.phpt b/ext/oci8/tests/bug27303_1.phpt
new file mode 100644 (file)
index 0000000..82c2d6f
--- /dev/null
@@ -0,0 +1,261 @@
+--TEST--
+Bug #27303 (OCIBindByName binds numeric PHP values as characters)
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+require(dirname(__FILE__)."/connect.inc");
+$sv = oci_server_version($c);
+$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
+if ($sv !== 1) {
+       die ("skip expected output only valid when using Oracle 19gR2 or 11gR2 databases");
+}
+?>
+--FILE--
+<?php
+
+// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs.
+// It will diff with a 32bit 11.2.0.1 DB
+
+require dirname(__FILE__).'/connect.inc';
+       
+$create_st = array();
+$create_st[] = "drop sequence myseq";
+$create_st[] = "drop table mytab";
+$create_st[] = "create sequence myseq";
+$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+
+foreach ($create_st as $statement) {
+       $stmt = oci_parse($c, $statement);
+       @oci_execute($stmt);
+}
+
+define('MYLIMIT', 200);
+
+$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
+
+$stid = OCIParse($c, $stmt);
+if (!$stid) { echo "Parse error"; die; }
+
+$r = OCIBindByName($stid, ':MYBV', $mybv);
+if (!$r) { echo "Bind error"; die; }
+
+for ($i = 1; $i < MYLIMIT; $i++) {
+       $r = OCIExecute($stid, OCI_DEFAULT);
+       if (!$r) { echo "Execute error"; die; }
+       var_dump($mybv);
+}
+
+OCICommit($c);
+
+$drop_st = array();
+$drop_st[] = "drop sequence myseq";
+$drop_st[] = "drop table mytab";
+
+foreach ($create_st as $statement) {
+       $stmt = oci_parse($c, $statement);
+       oci_execute($stmt);
+}
+
+echo "Done\n";
+?>
+--EXPECT--     
+string(1) "1"
+string(1) "2"
+string(1) "3"
+string(1) "4"
+string(1) "5"
+string(1) "6"
+string(1) "7"
+string(1) "8"
+string(1) "9"
+string(2) "10"
+string(2) "11"
+string(2) "12"
+string(2) "13"
+string(2) "14"
+string(2) "15"
+string(2) "16"
+string(2) "17"
+string(2) "18"
+string(2) "19"
+string(2) "20"
+string(2) "21"
+string(2) "22"
+string(2) "23"
+string(2) "24"
+string(2) "25"
+string(2) "26"
+string(2) "27"
+string(2) "28"
+string(2) "29"
+string(2) "30"
+string(2) "31"
+string(2) "32"
+string(2) "33"
+string(2) "34"
+string(2) "35"
+string(2) "36"
+string(2) "37"
+string(2) "38"
+string(2) "39"
+string(2) "40"
+string(2) "41"
+string(2) "42"
+string(2) "43"
+string(2) "44"
+string(2) "45"
+string(2) "46"
+string(2) "47"
+string(2) "48"
+string(2) "49"
+string(2) "50"
+string(2) "51"
+string(2) "52"
+string(2) "53"
+string(2) "54"
+string(2) "55"
+string(2) "56"
+string(2) "57"
+string(2) "58"
+string(2) "59"
+string(2) "60"
+string(2) "61"
+string(2) "62"
+string(2) "63"
+string(2) "64"
+string(2) "65"
+string(2) "66"
+string(2) "67"
+string(2) "68"
+string(2) "69"
+string(2) "70"
+string(2) "71"
+string(2) "72"
+string(2) "73"
+string(2) "74"
+string(2) "75"
+string(2) "76"
+string(2) "77"
+string(2) "78"
+string(2) "79"
+string(2) "80"
+string(2) "81"
+string(2) "82"
+string(2) "83"
+string(2) "84"
+string(2) "85"
+string(2) "86"
+string(2) "87"
+string(2) "88"
+string(2) "89"
+string(2) "90"
+string(2) "91"
+string(2) "92"
+string(2) "93"
+string(2) "94"
+string(2) "95"
+string(2) "96"
+string(2) "97"
+string(2) "98"
+string(2) "99"
+string(3) "100"
+string(3) "101"
+string(3) "102"
+string(3) "103"
+string(3) "104"
+string(3) "105"
+string(3) "106"
+string(3) "107"
+string(3) "108"
+string(3) "109"
+string(3) "110"
+string(3) "111"
+string(3) "112"
+string(3) "113"
+string(3) "114"
+string(3) "115"
+string(3) "116"
+string(3) "117"
+string(3) "118"
+string(3) "119"
+string(3) "120"
+string(3) "121"
+string(3) "122"
+string(3) "123"
+string(3) "124"
+string(3) "125"
+string(3) "126"
+string(3) "127"
+string(3) "128"
+string(3) "129"
+string(3) "130"
+string(3) "131"
+string(3) "132"
+string(3) "133"
+string(3) "134"
+string(3) "135"
+string(3) "136"
+string(3) "137"
+string(3) "138"
+string(3) "139"
+string(3) "140"
+string(3) "141"
+string(3) "142"
+string(3) "143"
+string(3) "144"
+string(3) "145"
+string(3) "146"
+string(3) "147"
+string(3) "148"
+string(3) "149"
+string(3) "150"
+string(3) "151"
+string(3) "152"
+string(3) "153"
+string(3) "154"
+string(3) "155"
+string(3) "156"
+string(3) "157"
+string(3) "158"
+string(3) "159"
+string(3) "160"
+string(3) "161"
+string(3) "162"
+string(3) "163"
+string(3) "164"
+string(3) "165"
+string(3) "166"
+string(3) "167"
+string(3) "168"
+string(3) "169"
+string(3) "170"
+string(3) "171"
+string(3) "172"
+string(3) "173"
+string(3) "174"
+string(3) "175"
+string(3) "176"
+string(3) "177"
+string(3) "178"
+string(3) "179"
+string(3) "180"
+string(3) "181"
+string(3) "182"
+string(3) "183"
+string(3) "184"
+string(3) "185"
+string(3) "186"
+string(3) "187"
+string(3) "188"
+string(3) "189"
+string(3) "190"
+string(3) "191"
+string(3) "192"
+string(3) "193"
+string(3) "194"
+string(3) "195"
+string(3) "196"
+string(3) "197"
+string(3) "198"
+string(3) "199"
+Done
\ No newline at end of file
similarity index 92%
rename from ext/oci8/tests/bug27303.phpt
rename to ext/oci8/tests/bug27303_1_11gR1.phpt
index 4dce84463fe332c64dc884369891bafa8b02aace..fe5c17c3ee43d2df5fc41c75fedb17af5ed35002 100644 (file)
@@ -5,9 +5,9 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
 $sv = oci_server_version($c);
-$sv = preg_match('/Release 1[12]\./', $sv, $matches);
+$sv = preg_match('/Release 11\.1\./', $sv, $matches);
 if ($sv !== 1) {
-       die ("skip expected output only valid when using Oracle 11g+ database");
+       die ("skip expected output only valid when using Oracle 11gR1 database");
 }
 ?>
 --FILE--
@@ -27,15 +27,13 @@ foreach ($create_st as $statement) {
 }
 
 define('MYLIMIT', 200);
-define('INITMYBV', 11);
 
 $stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
 
 $stid = OCIParse($c, $stmt);
 if (!$stid) { echo "Parse error"; die; }
 
-//$mybv = INITMYBV;   // Uncomment this for the 2nd test only
-$r = OCIBindByName($stid, ':MYBV', $mybv /*, 5 */);  // Uncomment this for the 3rd test only
+$r = OCIBindByName($stid, ':MYBV', $mybv);
 if (!$r) { echo "Bind error"; die; }
 
 for ($i = 1; $i < MYLIMIT; $i++) {
index 63200ed52e988e590989eb3a2969dd12e462e0be..44b9ce6c612cb7ce968573b10cb6c2c7b6247bb3 100644 (file)
@@ -5,14 +5,17 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
 $sv = oci_server_version($c);
-$sv = preg_match('/Release 1[12]\./', $sv, $matches);
+$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
 if ($sv !== 1) {
-       die ("skip expected output only valid when using Oracle 11g+ database");
+       die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 database");
 }
 ?>
 --FILE--
 <?php
 
+// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs.
+// It will diff with a 32bit 11.2.0.1 DB
+
 require dirname(__FILE__).'/connect.inc';
        
 $create_st = array();
@@ -34,8 +37,8 @@ $stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval)
 $stid = OCIParse($c, $stmt);
 if (!$stid) { echo "Parse error"; die; }
 
-$mybv = INITMYBV;   // Uncomment this for the 2nd test only
-$r = OCIBindByName($stid, ':MYBV', $mybv /*, 5 */);  // Uncomment this for the 3rd test only
+$mybv = INITMYBV;
+$r = OCIBindByName($stid, ':MYBV', $mybv);
 if (!$r) { echo "Bind error"; die; }
 
 for ($i = 1; $i < MYLIMIT; $i++) {
@@ -157,104 +160,104 @@ string(2) "96"
 string(2) "97"
 string(2) "98"
 string(2) "99"
-string(2) "10"
-string(2) "10"
-string(2) "10"
-string(2) "10"
-string(2) "10"
-string(2) "10"
-string(2) "10"
-string(2) "10"
-string(2) "10"
-string(2) "10"
-string(2) "11"
-string(2) "11"
-string(2) "11"
-string(2) "11"
-string(2) "11"
-string(2) "11"
-string(2) "11"
-string(2) "11"
-string(2) "11"
-string(2) "11"
-string(2) "12"
-string(2) "12"
-string(2) "12"
-string(2) "12"
-string(2) "12"
-string(2) "12"
-string(2) "12"
-string(2) "12"
-string(2) "12"
-string(2) "12"
-string(2) "13"
-string(2) "13"
-string(2) "13"
-string(2) "13"
-string(2) "13"
-string(2) "13"
-string(2) "13"
-string(2) "13"
-string(2) "13"
-string(2) "13"
-string(2) "14"
-string(2) "14"
-string(2) "14"
-string(2) "14"
-string(2) "14"
-string(2) "14"
-string(2) "14"
-string(2) "14"
-string(2) "14"
-string(2) "14"
-string(2) "15"
-string(2) "15"
-string(2) "15"
-string(2) "15"
-string(2) "15"
-string(2) "15"
-string(2) "15"
-string(2) "15"
-string(2) "15"
-string(2) "15"
-string(2) "16"
-string(2) "16"
-string(2) "16"
-string(2) "16"
-string(2) "16"
-string(2) "16"
-string(2) "16"
-string(2) "16"
-string(2) "16"
-string(2) "16"
-string(2) "17"
-string(2) "17"
-string(2) "17"
-string(2) "17"
-string(2) "17"
-string(2) "17"
-string(2) "17"
-string(2) "17"
-string(2) "17"
-string(2) "17"
-string(2) "18"
-string(2) "18"
-string(2) "18"
-string(2) "18"
-string(2) "18"
-string(2) "18"
-string(2) "18"
-string(2) "18"
-string(2) "18"
-string(2) "18"
-string(2) "19"
-string(2) "19"
-string(2) "19"
-string(2) "19"
-string(2) "19"
-string(2) "19"
-string(2) "19"
-string(2) "19"
-string(2) "19"
-string(2) "19"
-Done
+string(3) "100"
+string(3) "101"
+string(3) "102"
+string(3) "103"
+string(3) "104"
+string(3) "105"
+string(3) "106"
+string(3) "107"
+string(3) "108"
+string(3) "109"
+string(3) "110"
+string(3) "111"
+string(3) "112"
+string(3) "113"
+string(3) "114"
+string(3) "115"
+string(3) "116"
+string(3) "117"
+string(3) "118"
+string(3) "119"
+string(3) "120"
+string(3) "121"
+string(3) "122"
+string(3) "123"
+string(3) "124"
+string(3) "125"
+string(3) "126"
+string(3) "127"
+string(3) "128"
+string(3) "129"
+string(3) "130"
+string(3) "131"
+string(3) "132"
+string(3) "133"
+string(3) "134"
+string(3) "135"
+string(3) "136"
+string(3) "137"
+string(3) "138"
+string(3) "139"
+string(3) "140"
+string(3) "141"
+string(3) "142"
+string(3) "143"
+string(3) "144"
+string(3) "145"
+string(3) "146"
+string(3) "147"
+string(3) "148"
+string(3) "149"
+string(3) "150"
+string(3) "151"
+string(3) "152"
+string(3) "153"
+string(3) "154"
+string(3) "155"
+string(3) "156"
+string(3) "157"
+string(3) "158"
+string(3) "159"
+string(3) "160"
+string(3) "161"
+string(3) "162"
+string(3) "163"
+string(3) "164"
+string(3) "165"
+string(3) "166"
+string(3) "167"
+string(3) "168"
+string(3) "169"
+string(3) "170"
+string(3) "171"
+string(3) "172"
+string(3) "173"
+string(3) "174"
+string(3) "175"
+string(3) "176"
+string(3) "177"
+string(3) "178"
+string(3) "179"
+string(3) "180"
+string(3) "181"
+string(3) "182"
+string(3) "183"
+string(3) "184"
+string(3) "185"
+string(3) "186"
+string(3) "187"
+string(3) "188"
+string(3) "189"
+string(3) "190"
+string(3) "191"
+string(3) "192"
+string(3) "193"
+string(3) "194"
+string(3) "195"
+string(3) "196"
+string(3) "197"
+string(3) "198"
+string(3) "199"
+Done
\ No newline at end of file
diff --git a/ext/oci8/tests/bug27303_2_11gR1.phpt b/ext/oci8/tests/bug27303_2_11gR1.phpt
new file mode 100644 (file)
index 0000000..e1daef0
--- /dev/null
@@ -0,0 +1,260 @@
+--TEST--
+Bug #27303 (OCIBindByName binds numeric PHP values as characters)
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+require(dirname(__FILE__)."/connect.inc");
+$sv = oci_server_version($c);
+$sv = preg_match('/Release 11\.1\./', $sv, $matches);
+if ($sv !== 1) {
+       die ("skip expected output only valid when using Oracle 11gR1 database");
+}
+?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+       
+$create_st = array();
+$create_st[] = "drop sequence myseq";
+$create_st[] = "drop table mytab";
+$create_st[] = "create sequence myseq";
+$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+
+foreach ($create_st as $statement) {
+       $stmt = oci_parse($c, $statement);
+       oci_execute($stmt);
+}
+
+define('MYLIMIT', 200);
+define('INITMYBV', 11);
+
+$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
+
+$stid = OCIParse($c, $stmt);
+if (!$stid) { echo "Parse error"; die; }
+
+$mybv = INITMYBV;
+$r = OCIBindByName($stid, ':MYBV', $mybv);
+if (!$r) { echo "Bind error"; die; }
+
+for ($i = 1; $i < MYLIMIT; $i++) {
+       $r = OCIExecute($stid, OCI_DEFAULT);
+       if (!$r) { echo "Execute error"; die; }
+       var_dump($mybv);
+}
+
+OCICommit($c);
+
+$drop_st = array();
+$drop_st[] = "drop sequence myseq";
+$drop_st[] = "drop table mytab";
+
+foreach ($create_st as $statement) {
+       $stmt = oci_parse($c, $statement);
+       oci_execute($stmt);
+}
+
+echo "Done\n";
+?>
+--EXPECT--     
+string(1) "1"
+string(1) "2"
+string(1) "3"
+string(1) "4"
+string(1) "5"
+string(1) "6"
+string(1) "7"
+string(1) "8"
+string(1) "9"
+string(2) "10"
+string(2) "11"
+string(2) "12"
+string(2) "13"
+string(2) "14"
+string(2) "15"
+string(2) "16"
+string(2) "17"
+string(2) "18"
+string(2) "19"
+string(2) "20"
+string(2) "21"
+string(2) "22"
+string(2) "23"
+string(2) "24"
+string(2) "25"
+string(2) "26"
+string(2) "27"
+string(2) "28"
+string(2) "29"
+string(2) "30"
+string(2) "31"
+string(2) "32"
+string(2) "33"
+string(2) "34"
+string(2) "35"
+string(2) "36"
+string(2) "37"
+string(2) "38"
+string(2) "39"
+string(2) "40"
+string(2) "41"
+string(2) "42"
+string(2) "43"
+string(2) "44"
+string(2) "45"
+string(2) "46"
+string(2) "47"
+string(2) "48"
+string(2) "49"
+string(2) "50"
+string(2) "51"
+string(2) "52"
+string(2) "53"
+string(2) "54"
+string(2) "55"
+string(2) "56"
+string(2) "57"
+string(2) "58"
+string(2) "59"
+string(2) "60"
+string(2) "61"
+string(2) "62"
+string(2) "63"
+string(2) "64"
+string(2) "65"
+string(2) "66"
+string(2) "67"
+string(2) "68"
+string(2) "69"
+string(2) "70"
+string(2) "71"
+string(2) "72"
+string(2) "73"
+string(2) "74"
+string(2) "75"
+string(2) "76"
+string(2) "77"
+string(2) "78"
+string(2) "79"
+string(2) "80"
+string(2) "81"
+string(2) "82"
+string(2) "83"
+string(2) "84"
+string(2) "85"
+string(2) "86"
+string(2) "87"
+string(2) "88"
+string(2) "89"
+string(2) "90"
+string(2) "91"
+string(2) "92"
+string(2) "93"
+string(2) "94"
+string(2) "95"
+string(2) "96"
+string(2) "97"
+string(2) "98"
+string(2) "99"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+Done
index f290010f1541225d94b2d88744158bc26c44a080..639538847185a380d62ced5ffcbb70266a38088e 100644 (file)
@@ -26,8 +26,8 @@ $stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval)
 $stid = OCIParse($c, $stmt);
 if (!$stid) { echo "Parse error"; die; }
 
-$mybv = INITMYBV;   // Uncomment this for the 2nd test only
-$r = OCIBindByName($stid, ':MYBV', $mybv, 5, SQLT_INT);  // Uncomment this for the 3rd test only
+$mybv = INITMYBV;
+$r = OCIBindByName($stid, ':MYBV', $mybv, 5, SQLT_INT);
 if (!$r) { echo "Bind error"; die; }
 
 for ($i = 1; $i < MYLIMIT; $i++) {
index 031f0d1e12945546a4294dfdce2027a6cf6e5232..3c35c65b778240b734fa20393790039b52445572 100644 (file)
@@ -5,14 +5,17 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
 $sv = oci_server_version($c);
-$sv = preg_match('/Release 1[12]\./', $sv, $matches);
+$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
 if ($sv !== 1) {
-       die ("skip expected output only valid when using Oracle 11g+ database");
+       die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
 }
 ?>
 --FILE--
 <?php
 
+// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs.
+// It will diff with a 32bit 11.2.0.1 DB
+
 require dirname(__FILE__).'/connect.inc';
        
 $create_st = array();
@@ -27,15 +30,13 @@ foreach ($create_st as $statement) {
 }
 
 define('MYLIMIT', 200);
-define('INITMYBV', 11);
 
 $stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
 
 $stid = OCIParse($c, $stmt);
 if (!$stid) { echo "Parse error"; die; }
 
-//$mybv = INITMYBV;   // Uncomment this for the 2nd test only
-$r = OCIBindByName($stid, ':MYBV', $mybv, 0 );  // Uncomment this for the 3rd test only
+$r = OCIBindByName($stid, ':MYBV', $mybv, 0 );
 if (!$r) { echo "Bind error"; die; }
 
 for ($i = 1; $i < MYLIMIT; $i++) {
@@ -67,194 +68,194 @@ string(1) "6"
 string(1) "7"
 string(1) "8"
 string(1) "9"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "2"
-string(1) "2"
-string(1) "2"
-string(1) "2"
-string(1) "2"
-string(1) "2"
-string(1) "2"
-string(1) "2"
-string(1) "2"
-string(1) "2"
-string(1) "3"
-string(1) "3"
-string(1) "3"
-string(1) "3"
-string(1) "3"
-string(1) "3"
-string(1) "3"
-string(1) "3"
-string(1) "3"
-string(1) "3"
-string(1) "4"
-string(1) "4"
-string(1) "4"
-string(1) "4"
-string(1) "4"
-string(1) "4"
-string(1) "4"
-string(1) "4"
-string(1) "4"
-string(1) "4"
-string(1) "5"
-string(1) "5"
-string(1) "5"
-string(1) "5"
-string(1) "5"
-string(1) "5"
-string(1) "5"
-string(1) "5"
-string(1) "5"
-string(1) "5"
-string(1) "6"
-string(1) "6"
-string(1) "6"
-string(1) "6"
-string(1) "6"
-string(1) "6"
-string(1) "6"
-string(1) "6"
-string(1) "6"
-string(1) "6"
-string(1) "7"
-string(1) "7"
-string(1) "7"
-string(1) "7"
-string(1) "7"
-string(1) "7"
-string(1) "7"
-string(1) "7"
-string(1) "7"
-string(1) "7"
-string(1) "8"
-string(1) "8"
-string(1) "8"
-string(1) "8"
-string(1) "8"
-string(1) "8"
-string(1) "8"
-string(1) "8"
-string(1) "8"
-string(1) "8"
-string(1) "9"
-string(1) "9"
-string(1) "9"
-string(1) "9"
-string(1) "9"
-string(1) "9"
-string(1) "9"
-string(1) "9"
-string(1) "9"
-string(1) "9"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
+string(2) "10"
+string(2) "11"
+string(2) "12"
+string(2) "13"
+string(2) "14"
+string(2) "15"
+string(2) "16"
+string(2) "17"
+string(2) "18"
+string(2) "19"
+string(2) "20"
+string(2) "21"
+string(2) "22"
+string(2) "23"
+string(2) "24"
+string(2) "25"
+string(2) "26"
+string(2) "27"
+string(2) "28"
+string(2) "29"
+string(2) "30"
+string(2) "31"
+string(2) "32"
+string(2) "33"
+string(2) "34"
+string(2) "35"
+string(2) "36"
+string(2) "37"
+string(2) "38"
+string(2) "39"
+string(2) "40"
+string(2) "41"
+string(2) "42"
+string(2) "43"
+string(2) "44"
+string(2) "45"
+string(2) "46"
+string(2) "47"
+string(2) "48"
+string(2) "49"
+string(2) "50"
+string(2) "51"
+string(2) "52"
+string(2) "53"
+string(2) "54"
+string(2) "55"
+string(2) "56"
+string(2) "57"
+string(2) "58"
+string(2) "59"
+string(2) "60"
+string(2) "61"
+string(2) "62"
+string(2) "63"
+string(2) "64"
+string(2) "65"
+string(2) "66"
+string(2) "67"
+string(2) "68"
+string(2) "69"
+string(2) "70"
+string(2) "71"
+string(2) "72"
+string(2) "73"
+string(2) "74"
+string(2) "75"
+string(2) "76"
+string(2) "77"
+string(2) "78"
+string(2) "79"
+string(2) "80"
+string(2) "81"
+string(2) "82"
+string(2) "83"
+string(2) "84"
+string(2) "85"
+string(2) "86"
+string(2) "87"
+string(2) "88"
+string(2) "89"
+string(2) "90"
+string(2) "91"
+string(2) "92"
+string(2) "93"
+string(2) "94"
+string(2) "95"
+string(2) "96"
+string(2) "97"
+string(2) "98"
+string(2) "99"
+string(3) "100"
+string(3) "101"
+string(3) "102"
+string(3) "103"
+string(3) "104"
+string(3) "105"
+string(3) "106"
+string(3) "107"
+string(3) "108"
+string(3) "109"
+string(3) "110"
+string(3) "111"
+string(3) "112"
+string(3) "113"
+string(3) "114"
+string(3) "115"
+string(3) "116"
+string(3) "117"
+string(3) "118"
+string(3) "119"
+string(3) "120"
+string(3) "121"
+string(3) "122"
+string(3) "123"
+string(3) "124"
+string(3) "125"
+string(3) "126"
+string(3) "127"
+string(3) "128"
+string(3) "129"
+string(3) "130"
+string(3) "131"
+string(3) "132"
+string(3) "133"
+string(3) "134"
+string(3) "135"
+string(3) "136"
+string(3) "137"
+string(3) "138"
+string(3) "139"
+string(3) "140"
+string(3) "141"
+string(3) "142"
+string(3) "143"
+string(3) "144"
+string(3) "145"
+string(3) "146"
+string(3) "147"
+string(3) "148"
+string(3) "149"
+string(3) "150"
+string(3) "151"
+string(3) "152"
+string(3) "153"
+string(3) "154"
+string(3) "155"
+string(3) "156"
+string(3) "157"
+string(3) "158"
+string(3) "159"
+string(3) "160"
+string(3) "161"
+string(3) "162"
+string(3) "163"
+string(3) "164"
+string(3) "165"
+string(3) "166"
+string(3) "167"
+string(3) "168"
+string(3) "169"
+string(3) "170"
+string(3) "171"
+string(3) "172"
+string(3) "173"
+string(3) "174"
+string(3) "175"
+string(3) "176"
+string(3) "177"
+string(3) "178"
+string(3) "179"
+string(3) "180"
+string(3) "181"
+string(3) "182"
+string(3) "183"
+string(3) "184"
+string(3) "185"
+string(3) "186"
+string(3) "187"
+string(3) "188"
+string(3) "189"
+string(3) "190"
+string(3) "191"
+string(3) "192"
+string(3) "193"
+string(3) "194"
+string(3) "195"
+string(3) "196"
+string(3) "197"
+string(3) "198"
+string(3) "199"
 Done
diff --git a/ext/oci8/tests/bug27303_4_11gR1.phpt b/ext/oci8/tests/bug27303_4_11gR1.phpt
new file mode 100644 (file)
index 0000000..0c88360
--- /dev/null
@@ -0,0 +1,258 @@
+--TEST--
+Bug #27303 (OCIBindByName binds numeric PHP values as characters)
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+require(dirname(__FILE__)."/connect.inc");
+$sv = oci_server_version($c);
+$sv = preg_match('/Release 11\.1\./', $sv, $matches);
+if ($sv !== 1) {
+       die ("skip expected output only valid when using Oracle 11gR1 database");
+}
+?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+       
+$create_st = array();
+$create_st[] = "drop sequence myseq";
+$create_st[] = "drop table mytab";
+$create_st[] = "create sequence myseq";
+$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+
+foreach ($create_st as $statement) {
+       $stmt = oci_parse($c, $statement);
+       oci_execute($stmt);
+}
+
+define('MYLIMIT', 200);
+
+$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
+
+$stid = OCIParse($c, $stmt);
+if (!$stid) { echo "Parse error"; die; }
+
+$r = OCIBindByName($stid, ':MYBV', $mybv, 0 );
+if (!$r) { echo "Bind error"; die; }
+
+for ($i = 1; $i < MYLIMIT; $i++) {
+       $r = OCIExecute($stid, OCI_DEFAULT);
+       if (!$r) { echo "Execute error"; die; }
+       var_dump($mybv);
+}
+
+OCICommit($c);
+
+$drop_st = array();
+$drop_st[] = "drop sequence myseq";
+$drop_st[] = "drop table mytab";
+
+foreach ($create_st as $statement) {
+       $stmt = oci_parse($c, $statement);
+       oci_execute($stmt);
+}
+
+echo "Done\n";
+?>
+--EXPECT--     
+string(1) "1"
+string(1) "2"
+string(1) "3"
+string(1) "4"
+string(1) "5"
+string(1) "6"
+string(1) "7"
+string(1) "8"
+string(1) "9"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+Done
index d6c2978635681487aa3083251da9979073facb13..eee21c3aef6272f1ece958462f7b9815aa7741a6 100644 (file)
@@ -1,7 +1,11 @@
 --TEST--
 Bug #44113 (New collection creation can fail with OCI-22303)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php 
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+require(dirname(__FILE__).'/details.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+?>
 --FILE--
 <?php
 
index 510c7decda4710fe52a79bbb95389e97aa6c588c..d46ea299222c477b0da753a6d8dc9d9ce06ab7ce 100644 (file)
@@ -80,11 +80,11 @@ oci_close($c);
 <?php exit(0); ?>
 --EXPECTF--
 First Insert
-Could not execute: ORA-02290: check constraint (SYSTEM.COMMIT_002_TAB_CHECK_X) violated
+Could not execute: ORA-02290: %s (SYSTEM.COMMIT_002_TAB_CHECK_X) %s
 Second Insert
 
-Warning: oci_commit(): ORA-02091: transaction rolled back
+Warning: oci_commit(): ORA-02091: %s
 ORA-02290: %s (SYSTEM.COMMIT_002_TAB_CHECK_Y) %s in %scommit_002.php on line %d
-Could not commit: ORA-02091: transaction rolled back
+Could not commit: ORA-02091: %s
 ORA-02290: %s (SYSTEM.COMMIT_002_TAB_CHECK_Y) %s
 ===DONE===
index 2ef2673fd1a236a7e83e4de234aa5aa26f5f378f..9f55f532635d19cefe248878a51b9e1752ca1ab2 100644 (file)
@@ -5,6 +5,7 @@ Set and get of connection attributes with errors.
 require(dirname(__FILE__)."/connect.inc");
 if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
 if ($test_drcp) die("skip output might vary with DRCP");
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
 
 $sv = oci_server_version($c);
 $sv = preg_match('/Release 1[012]\./', $sv, $matches);
index 75a136ce34af77fb0340157849bbe490c5e2e3fb..922b8c4f49c35bdb88aba8b3371b84f89db8a641 100644 (file)
@@ -12,6 +12,9 @@
  * greater, and $dbase should be set to the tnsnames.ora entry
  * corresponding to the POOLED server instance or an Easy Connect
  * string like hostname:port/service_name:POOLED
+ *
+ * Set $stress_test to TRUE if you want to run some longer/slower/more
+ * memory intensive tests.
  */
 
 if (file_exists(dirname(__FILE__)."/details_local.inc")) {
@@ -33,12 +36,19 @@ if (file_exists(dirname(__FILE__)."/details_local.inc")) {
         } else {
             $oracle_on_localhost = FALSE;
         }
+        $stress_test = getenv('PHP_OCI8_STRESS_TEST');
+        if (false !== $stress_test && 0 == strcasecmp($stress_test,'TRUE')) {
+            $stress_test = TRUE;
+        } else {
+            $stress_test = FALSE;
+        }
     } else {
         $user                                          = "system";
         $password                                      = "oracle";
         $dbase                                         = "localhost/XE";
         $oracle_on_localhost           = TRUE;
         $test_drcp                                     = FALSE;
+        $stress_test                           = FALSE;
     }
     
     /*
index 30250ec2435ceb466599d6d9fd862eb027210aa9..993198c4de3dab4c55bfef8a4ed5e1e246e1cb97 100644 (file)
@@ -4,6 +4,8 @@ Test External Authentication errors with oci_connect
 <?php
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 if (substr(PHP_OS, 0, 3) == 'WIN') die("skip feature not available on Windows platforms");
+require(dirname(__FILE__).'/details.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
 ?>
 --INI--
 oci8.privileged_connect=1
index d648eef08b1366c87fd05d79b80ce5f07ad91fe2..d3bee0bfc334a6965746b7afe1004cf33ab6761f 100644 (file)
@@ -4,6 +4,8 @@ Test External Authentication errors with oci_new_connect
 <?php
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 if (substr(PHP_OS, 0, 3) == 'WIN') die("skip feature not available on Windows platforms");
+require(dirname(__FILE__).'/details.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
 ?>
 --INI--
 oci8.privileged_connect=1
index 021492f765b04de349436188d67935109c4fbed0..e159c50f90dfa4b52099939f679cf30fb5ff5dab 100644 (file)
@@ -4,6 +4,8 @@ Test External Authentication errors with oci_pconnect
 <?php
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 if (substr(PHP_OS, 0, 3) == 'WIN') die("skip feature not available on Windows platforms");
+require(dirname(__FILE__).'/details.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
 ?>
 --INI--
 oci8.privileged_connect=1
index 5ae2d45ebce22e58990e11f442b56b0fb8d47827..0280ef6de8040ff3cbdf4ff9734149e7a53f3ab1 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #49560 (LOB resource destructor and refcount test)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); 
+require(dirname(__FILE__).'/details.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+?>
 --FILE--
 <?php