summaryrefslogtreecommitdiff
path: root/ext/oci8
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2009-04-10 14:09:48 +0200
committerSean Finney <seanius@debian.org>2009-04-10 14:09:48 +0200
commitcd0b49c72aee33b3e44a9c589fcd93b9e1c7a64f (patch)
tree1315c623bb7d9dfa8d366fa9cd2c6834ceeb5da5 /ext/oci8
parent9ea47aab740772adf0c69d8c94b208a464e599ea (diff)
downloadphp-cd0b49c72aee33b3e44a9c589fcd93b9e1c7a64f.tar.gz
Imported Upstream version 5.2.9.dfsg.1upstream/5.2.9.dfsg.1
Diffstat (limited to 'ext/oci8')
-rw-r--r--ext/oci8/config.m44
-rw-r--r--ext/oci8/oci8.c6
-rw-r--r--ext/oci8/oci8_collection.c4
-rw-r--r--ext/oci8/oci8_interface.c4
-rw-r--r--ext/oci8/oci8_lob.c9
-rw-r--r--ext/oci8/oci8_statement.c4
-rw-r--r--ext/oci8/package2.xml104
-rw-r--r--ext/oci8/php_oci8.h4
-rw-r--r--ext/oci8/php_oci8_int.h4
-rw-r--r--ext/oci8/tests/bug37220.phpt68
-rw-r--r--ext/oci8/tests/bug43497.phpt11
-rw-r--r--ext/oci8/tests/bug43497_92.phpt303
-rw-r--r--ext/oci8/tests/bug44113.phpt5
-rw-r--r--ext/oci8/tests/bug44206.phpt24
-rw-r--r--ext/oci8/tests/connect_scope1.phpt93
-rw-r--r--ext/oci8/tests/connect_scope2.phpt93
-rw-r--r--ext/oci8/tests/connect_scope_try1.phpt100
-rw-r--r--ext/oci8/tests/connect_scope_try2.phpt100
-rw-r--r--ext/oci8/tests/connect_scope_try3.phpt100
-rw-r--r--ext/oci8/tests/connect_scope_try4.phpt100
-rw-r--r--ext/oci8/tests/connect_scope_try5.phpt100
-rw-r--r--ext/oci8/tests/connect_scope_try6.phpt100
-rw-r--r--ext/oci8/tests/drcp_characterset.phpt61
-rw-r--r--ext/oci8/tests/drcp_conn_close1.phpt45
-rw-r--r--ext/oci8/tests/drcp_conn_close2.phpt46
-rw-r--r--ext/oci8/tests/drcp_connect1.phpt86
-rw-r--r--ext/oci8/tests/drcp_functions.inc93
-rw-r--r--ext/oci8/tests/drcp_newconnect.phpt43
-rw-r--r--ext/oci8/tests/drcp_pconn_close1.phpt44
-rw-r--r--ext/oci8/tests/drcp_pconn_close2.phpt46
-rw-r--r--ext/oci8/tests/drcp_privileged.phpt47
-rw-r--r--ext/oci8/tests/drcp_scope1.phpt92
-rw-r--r--ext/oci8/tests/drcp_scope2.phpt91
-rw-r--r--ext/oci8/tests/drcp_scope3.phpt61
-rw-r--r--ext/oci8/tests/drcp_scope4.phpt62
-rw-r--r--ext/oci8/tests/drcp_scope5.phpt63
-rw-r--r--ext/oci8/tests/lob_042.phpt2
-rw-r--r--ext/oci8/tests/minfo.phpt19
-rw-r--r--ext/oci8/tests/password.phpt70
-rw-r--r--ext/oci8/tests/password_2.phpt32
-rw-r--r--ext/oci8/tests/password_new.phpt20
-rw-r--r--ext/oci8/tests/password_old.phpt28
-rw-r--r--ext/oci8/tests/pecl_bug10194_blob.phpt21
-rw-r--r--ext/oci8/tests/pecl_bug10194_blob_64.phpt54
-rw-r--r--ext/oci8/tests/testping.phpt25
45 files changed, 2393 insertions, 98 deletions
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4
index 37c99e880..3f343f3ca 100644
--- a/ext/oci8/config.m4
+++ b/ext/oci8/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.55.2.3.2.12 2008/01/16 00:42:02 sixd Exp $
+dnl $Id: config.m4,v 1.55.2.3.2.13 2008/05/13 16:06:55 sixd Exp $
dnl
if test -z "$SED"; then
@@ -371,7 +371,7 @@ dnl version in /usr/lib
AC_MSG_CHECKING([Oracle Instant Client SDK header directory])
dnl Header directory for Instant Client SDK RPM install
- OCISDKRPMINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!^/usr/lib/oracle/\(.*\)/client\(.*\)/lib/*$!/usr/include/oracle/\1/client\2!'`
+ OCISDKRPMINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!^/usr/lib/oracle/\(.*\)/client\('${LIBDIR_SUFFIX}'\)*/lib[/]*$!/usr/include/oracle/\1/client\2!'`
dnl Header directory for Instant Client SDK zip file install
OCISDKZIPINC=$PHP_OCI8_INSTANT_CLIENT/sdk/include
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 8f8a2b8cd..6a13b162e 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -26,7 +26,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8.c,v 1.269.2.16.2.43 2008/04/10 21:53:46 sixd Exp $ */
+/* $Id: oci8.c,v 1.269.2.16.2.44 2008/12/31 11:17:40 sebastian Exp $ */
/* TODO
*
* file://localhost/www/docs/oci10/ociaahan.htm#423823 - implement lob_empty() with OCI_ATTR_LOBEMPTY
@@ -674,7 +674,7 @@ PHP_MINFO_FUNCTION(oci)
php_info_print_table_start();
php_info_print_table_row(2, "OCI8 Support", "enabled");
php_info_print_table_row(2, "Version", "1.2.5");
- php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.43 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.44 $");
snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent));
php_info_print_table_row(2, "Active Persistent Connections", buf);
diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c
index 73879a674..5040ebae1 100644
--- a/ext/oci8/oci8_collection.c
+++ b/ext/oci8/oci8_collection.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_collection.c,v 1.5.2.3.2.9 2008/02/15 23:05:19 sixd Exp $ */
+/* $Id: oci8_collection.c,v 1.5.2.3.2.10 2008/12/31 11:17:40 sebastian Exp $ */
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index 071bfaba4..5fa92cd5e 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_interface.c,v 1.8.2.7.2.16 2008/04/02 14:56:43 tony2001 Exp $ */
+/* $Id: oci8_interface.c,v 1.8.2.7.2.17 2008/12/31 11:17:40 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index 1bccf3188..0a6aa8c61 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_lob.c,v 1.7.2.6.2.18 2008/02/25 23:52:10 sixd Exp $ */
+/* $Id: oci8_lob.c,v 1.7.2.6.2.20 2008/12/31 11:17:40 sebastian Exp $ */
@@ -302,6 +302,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
}
if (is_clob) {
+#ifdef OCI_NLS_CHARSET_MAXBYTESZ
PHP_OCI_CALL_RETURN(connection->errcode, OCINlsNumericInfoGet, (connection->env, connection->err, &bytes_per_char, OCI_NLS_CHARSET_MAXBYTESZ));
if (connection->errcode != OCI_SUCCESS) {
@@ -309,6 +310,10 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+#else
+ /* Oracle 8.1 doesn't define OCI_NLS_CHARSET_MAXBYTESZ, so allocate worst case size */
+ bytes_per_char = 4;
+#endif
} else {
/* BLOBs don't have encoding, so bytes_per_char == 1 */
}
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index 603dbe5d9..2c565cfe1 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_statement.c,v 1.7.2.14.2.33 2008/04/02 14:56:43 tony2001 Exp $ */
+/* $Id: oci8_statement.c,v 1.7.2.14.2.34 2008/12/31 11:17:40 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
diff --git a/ext/oci8/package2.xml b/ext/oci8/package2.xml
index ff96be442..e80c02d31 100644
--- a/ext/oci8/package2.xml
+++ b/ext/oci8/package2.xml
@@ -6,8 +6,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<name>oci8</name>
<channel>pecl.php.net</channel>
<summary>OCI8 functions</summary>
- <description>These functions allow you to access Oracle database servers using
-the Oracle Call Interface (OCI8).
+ <description>This extension allows you to access Oracle databases using the Oracle Call Interface (OCI8). It can be built using Oracle 9.2, 10.2 or 11.1 client libraries, and allows Oracle's standard cross-version connectivity.
</description>
<lead>
<name>Antony Dovgal</name>
@@ -33,31 +32,28 @@ the Oracle Call Interface (OCI8).
<email>sixd@php.net</email>
<active>yes</active>
</lead>
- <date>2007-09-01</date>
+ <date>2008-05-12</date>
<time>15:00:00</time>
<version>
- <release>1.2.4</release>
- <api>1.2.4</api>
+ <release>1.2.5</release>
+ <api>1.2.5</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP</license>
- <notes>Added Oracle 11g support.
-Fixed PECL bug #10194 (crash in Oracle client when memory limit reached in the callback).
-Fixed bug #42173 (oci_field_type fixes for INTERVAL and TIMESTAMP types).
-Fixed bug #42134 (oci_error() returns false after oci_new_collection() fails).
-Fixed bug #41917 (oci_field_precision and oci_field_scale datatypes fixed).
-Fixed bug #41711 (Null temporary lobs not supported).
-Fixed bug #41594 (Statement cache is flushed too frequently).
-Fixed bug #40415 (oci_fetch_all and nested cursors, allocate descriptors dynamically)
-Fixed segfault on rebinding and re-executing a statement with LOBs.
-Fixed compile failure in ZTS mode when collections support is missing.
-Allowed statement cache size to be set for non-persistent connections.
-Improved oci_password_change() to close persistent connections on shutdown (to update hashed connection details).
-Changed oci_pconnect() to behave like oci_connect() when SYSDBA and SYSOPER privileges are used.
-Various minor improvements.
+ <notes>
+This release is based on the OCI8 included in PHP 5.2.6, with the addition of the fix for http://pecl.php.net/bugs/bug.php?id=13523.
+--------
+Fixed bug #42496 (cursor leak selecting LOBs http://bugs.php.net/bug.php?id=42496
+Fixed bug #42841 (crash with REF CURSORS when statement caching enabled) http://bugs.php.net/bug.php?id=42841
+Fixed bug #43497 (Temporary LOB leak) http://bugs.php.net/bug.php?id=43497
+Fixed bug #44206 (OCI8 selecting ref cursors leads to ORA-1000 maximum open cursors reached).
+Fixed bug #44008 (OCI8 incorrect usage of OCI-Lob->close crashes PHP).
+Fixed bug #44113 (new collection creation can fail with OCI-22303) http://bugs.php.net/bug.php?id=44113
+Enhancement - make -with-oci8=instantclient with no directory specified look for RPM install
+Enhancement - compile with 64bit Instant Client RPMs (bug http://bugs.php.net/bug.php?id=41941, http://pecl.php.net/bugs/bug.php?id=13523)
</notes>
<contents>
<dir name="/">
@@ -97,6 +93,7 @@ Various minor improvements.
<file name="bug35973.phpt" role="test" />
<file name="bug36010.phpt" role="test" />
<file name="bug36096.phpt" role="test" />
+ <file name="bug37220.phpt" role="test" />
<file name="bug37581.phpt" role="test" />
<file name="bug38161.phpt" role="test" />
<file name="bug38173.phpt" role="test" />
@@ -104,6 +101,17 @@ Various minor improvements.
<file name="bug40415.phpt" role="test" />
<file name="bug42134.phpt" role="test" />
<file name="bug42173.phpt" role="test" />
+ <file name="bug42496_1.phpt" role="test" />
+ <file name="bug42496_2.phpt" role="test" />
+ <file name="bug42841.phpt" role="test" />
+ <file name="bug43492_2.phpt" role="test" />
+ <file name="bug43492.phpt" role="test" />
+ <file name="bug43497_92.phpt" role="test" />
+ <file name="bug43497.phpt" role="test" />
+ <file name="bug44008.phpt" role="test" />
+ <file name="bug44113.phpt" role="test" />
+ <file name="bug44206.phpt" role="test" />
+ <file name="bug6109.phpt" role="test" />
<file name="close.phpt" role="test" />
<file name="coll_001.phpt" role="test" />
<file name="coll_002_func.phpt" role="test" />
@@ -144,6 +152,14 @@ Various minor improvements.
<file name="connect.inc" role="test" />
<file name="connect_old.phpt" role="test" />
<file name="connect.phpt" role="test" />
+ <file name="connect_scope1.phpt" role="test" />
+ <file name="connect_scope2.phpt" role="test" />
+ <file name="connect_scope_try1.phpt" role="test" />
+ <file name="connect_scope_try2.phpt" role="test" />
+ <file name="connect_scope_try3.phpt" role="test" />
+ <file name="connect_scope_try4.phpt" role="test" />
+ <file name="connect_scope_try5.phpt" role="test" />
+ <file name="connect_scope_try6.phpt" role="test" />
<file name="connect_with_charset_001.phpt" role="test" />
<file name="connect_without_oracle_home_old.phpt" role="test" />
<file name="connect_without_oracle_home.phpt" role="test" />
@@ -166,6 +182,20 @@ Various minor improvements.
<file name="define.phpt" role="test" />
<file name="descriptors.phpt" role="test" />
<file name="details.inc" role="test" />
+ <file name="drcp_characterset.phpt" role="test" />
+ <file name="drcp_conn_close1.phpt" role="test" />
+ <file name="drcp_conn_close2.phpt" role="test" />
+ <file name="drcp_connect1.phpt" role="test" />
+ <file name="drcp_functions.inc" role="test" />
+ <file name="drcp_newconnect.phpt" role="test" />
+ <file name="drcp_pconn_close1.phpt" role="test" />
+ <file name="drcp_pconn_close2.phpt" role="test" />
+ <file name="drcp_privileged.phpt" role="test" />
+ <file name="drcp_scope1.phpt" role="test" />
+ <file name="drcp_scope2.phpt" role="test" />
+ <file name="drcp_scope3.phpt" role="test" />
+ <file name="drcp_scope4.phpt" role="test" />
+ <file name="drcp_scope5.phpt" role="test" />
<file name="drop_table.inc" role="test" />
<file name="drop_type.inc" role="test" />
<file name="error1.phpt" role="test" />
@@ -231,10 +261,13 @@ Various minor improvements.
<file name="lob_038.phpt" role="test" />
<file name="lob_039.phpt" role="test" />
<file name="lob_040.phpt" role="test" />
+ <file name="lob_041.phpt" role="test" />
+ <file name="lob_042.phpt" role="test" />
<file name="lob_aliases.phpt" role="test" />
<file name="lob_null.phpt" role="test" />
<file name="lob_temp1.phpt" role="test" />
<file name="lob_temp.phpt" role="test" />
+ <file name="minfo.phpt" role="test" />
<file name="num.phpt" role="test" />
<file name="oci8safemode.phpt" role="test" />
<file name="oci_execute_segfault.phpt" role="test" />
@@ -245,6 +278,7 @@ Various minor improvements.
<file name="password_new.phpt" role="test" />
<file name="password_old.phpt" role="test" />
<file name="password.phpt" role="test" />
+ <file name="pecl_bug10194_blob_64.phpt" role="test" />
<file name="pecl_bug10194_blob.phpt" role="test" />
<file name="pecl_bug10194.phpt" role="test" />
<file name="pecl_bug8816.phpt" role="test" />
@@ -253,6 +287,7 @@ Various minor improvements.
<file name="prefetch.phpt" role="test" />
<file name="privileged_connect1.phpt" role="test" />
<file name="privileged_connect.phpt" role="test" />
+ <file name="rowid_bind.phpt" role="test" />
<file name="select_null.phpt" role="test" />
<file name="serverversion.phpt" role="test" />
<file name="skipif.inc" role="test" />
@@ -260,8 +295,10 @@ Various minor improvements.
<file name="statement_type_old.phpt" role="test" />
<file name="statement_type.phpt" role="test" />
<file name="test.gif" role="test" />
+ <file name="testping.phpt" role="test" />
<file name="test.txt" role="test" />
<file name="uncommitted.phpt" role="test" />
+ <file name="xmltype_01.phpt" role="test" />
</dir> <!-- //tests -->
<file name="config.m4" role="src" />
<file name="config.w32" role="src" />
@@ -280,7 +317,7 @@ Various minor improvements.
<dependencies>
<required>
<php>
- <min>4.3.11</min>
+ <min>4.3.10</min>
<max>6.0.0</max>
<exclude>6.0.0</exclude>
</php>
@@ -294,6 +331,31 @@ Various minor improvements.
<configureoption default="autodetect" name="with-oci8" prompt="Please provide the path to ORACLE_HOME dir. Use &apos;instantclient,/path/to/instant/client/lib&apos; if you&apos;re compiling against Oracle Instant Client" />
</extsrcrelease>
<changelog>
+ <release>
+ <version>
+ <release>1.2.4</release>
+ <api>1.2.4</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>Fixed PECL bug #10194 (crash in Oracle client when memory limit reached in the callback)
+Fixed bug #42173 (oci_field_type fixes for INTERVAL and TIMESTAMP types)
+Fixed bug #42134 (oci_error() returns false after oci_new_collection() fails)
+Fixed bug #41917 (oci_field_precision and oci_field_scale datatypes fixed)
+Fixed bug #41711 (Null temporary lobs not supported)
+Fixed bug #41594 (Statement cache is flushed too frequently)
+Fixed bug #40415 (oci_fetch_all and nested cursors, allocate descriptors dynamically)
+Fixed segfault on rebinding and re-executing a statement with LOBs.
+Fixed compile failure in ZTS mode when collections support is missing.
+Allowed statement cache size to be set for non-persistent connections.
+Improved oci_password_change() to close persistent connections on shutdown (to update hashed connection details)
+Changed oci_pconnect() to behave like oci_connect() when SYSDBA and SYSOPER privileges are used.
+Various minor improvements.
+ </notes>
+ </release>
<release>
<version>
<release>1.2.3</release>
@@ -312,6 +374,8 @@ Fixed bug #39732 (oci_bind_array_by_name doesn&apos;t work on Solaris 64bit).
Fixed PECL bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column).
Various minor improvements.
</notes>
+ </release>
+ <release>
<version>
<release>1.2.2</release>
<api>1.2.2</api>
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index f4f332af7..25a744705 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_oci8.h,v 1.36.2.2.2.2 2007/12/31 07:20:09 sebastian Exp $ */
+/* $Id: php_oci8.h,v 1.36.2.2.2.3 2008/12/31 11:17:40 sebastian Exp $ */
#if HAVE_OCI8
# ifndef PHP_OCI8_H
diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index 6e9ed5e93..a0a762989 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_oci8_int.h,v 1.11.2.6.2.24 2008/02/25 23:52:10 sixd Exp $ */
+/* $Id: php_oci8_int.h,v 1.11.2.6.2.25 2008/12/31 11:17:40 sebastian Exp $ */
#if HAVE_OCI8
# ifndef PHP_OCI8_INT_H
diff --git a/ext/oci8/tests/bug37220.phpt b/ext/oci8/tests/bug37220.phpt
new file mode 100644
index 000000000..6743165b7
--- /dev/null
+++ b/ext/oci8/tests/bug37220.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Bug #37220 (LOB Type mismatch when using windows & oci8.dll)
+--SKIPIF--
+<?php if (!extension_loaded("oci8")) print "skip"; ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+// Initialization
+
+$stmtarray = array(
+ "create table bug37220_tab( mycolumn xmltype not null)",
+ "insert into bug37220_tab values(xmltype('<THETAG myID=\"1234\"></THETAG>'))"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+// Now let's update the row where myId = 1234 and change the tag
+// 'THETAG' to 'MYTAG' (mycolumn is an XMLTYPE datatype and
+// bug37220_tab a normal Oracle table)
+
+$query = "UPDATE bug37220_tab
+ SET bug37220_tab.mycolumn = updateXML(bug37220_tab.mycolumn,'/THETAG',xmltype.createXML(:data))
+ WHERE existsNode(bug37220_tab.mycolumn,'/THETAG[@myID=\"1234\"]') = 1";
+$stmt = oci_parse ($c, $query);
+$clob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($stmt, ':data', $clob, -1, OCI_B_CLOB);
+$clob->writetemporary("<MYTAG/>", OCI_TEMP_CLOB);
+$success = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS);
+oci_free_statement($stmt);
+$clob->close();
+
+// Query back the change
+
+$query = "select * from bug37220_tab";
+$stmt = oci_parse ($c, $query);
+
+oci_execute($stmt);
+
+while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
+ foreach ($row as $item) {
+ echo $item."\n";
+ }
+ echo "\n";
+}
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table bug37220_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
+
+echo "Done\n";
+
+?>
+--EXPECT--
+<MYTAG/>
+
+Done
diff --git a/ext/oci8/tests/bug43497.phpt b/ext/oci8/tests/bug43497.phpt
index 908fe5897..0fc6a97b3 100644
--- a/ext/oci8/tests/bug43497.phpt
+++ b/ext/oci8/tests/bug43497.phpt
@@ -1,7 +1,16 @@
--TEST--
Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+ob_start();
+phpinfo(INFO_MODULES);
+$phpinfo = ob_get_clean();
+$ov = preg_match('/Oracle Version => 9/', $phpinfo);
+if ($ov === 1) {
+ die ("skip expected output only valid for Oracle clients from 10g onwards");
+}
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bug43497_92.phpt b/ext/oci8/tests/bug43497_92.phpt
new file mode 100644
index 000000000..e2cb1ce48
--- /dev/null
+++ b/ext/oci8/tests/bug43497_92.phpt
@@ -0,0 +1,303 @@
+--TEST--
+Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+ob_start();
+phpinfo(INFO_MODULES);
+$phpinfo = ob_get_clean();
+$ov = preg_match('/Oracle Version => 9.2/', $phpinfo);
+if ($ov !== 1) {
+ die ("skip expected output only valid for Oracle 9.2 clients");
+}
+?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+function sessionid($c) // determines and returns current session ID
+{
+ $query = "select sid from v\$session where audsid = userenv('sessionid')";
+
+ $stmt = oci_parse($c, $query);
+
+ if (oci_execute($stmt, OCI_DEFAULT)) {
+ $row = oci_fetch($stmt);
+ return oci_result($stmt, 1);
+ }
+
+ return null;
+}
+
+
+function templobs($c, $sid) // returns number of temporary LOBs
+{
+ $query = "select abstract_lobs from v\$temporary_lobs where sid = " . $sid;
+
+ $stmt = oci_parse($c, $query);
+
+ if (oci_execute($stmt, OCI_DEFAULT)) {
+ $row = oci_fetch($stmt);
+ $val = oci_result($stmt, 1);
+ oci_free_statement($stmt);
+ return $val;
+ }
+ return null;
+}
+
+
+// Read all XML data using explicit LOB locator
+function readxmltab_ex($c)
+{
+ $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
+
+ $cntchk = 0;
+ if (oci_execute($stmt)) {
+ while ($result = oci_fetch_array($stmt, OCI_NUM)) {
+ $result[0]->free(); // cleanup properly
+ ++$cntchk;
+ }
+ }
+ echo "Loop count check = $cntchk\n";
+}
+
+// Read all XML data using explicit LOB locator but without freeing the temp lobs
+function readxmltab_ex_nofree($c)
+{
+ $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
+
+ $cntchk = 0;
+ if (oci_execute($stmt)) {
+ while ($result = oci_fetch_array($stmt, OCI_NUM)) {
+ ++$cntchk;
+ }
+ }
+ echo "Loop count check = $cntchk\n";
+}
+
+// Read all XML data using implicit LOB locator
+function readxmltab_im($c)
+{
+ $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
+
+ $cntchk = 0;
+ if (oci_execute($stmt)) {
+ while ($result = oci_fetch_array($stmt, OCI_NUM+OCI_RETURN_LOBS)) {
+ ++$cntchk;
+ }
+ }
+ echo "Loop count check = $cntchk\n";
+}
+
+function createxmltab($c) // create table w/ field of XML type
+{
+ @dropxmltab($c);
+ $stmt = oci_parse($c, "create table bug43497_tab (id number primary key, xml xmltype)");
+ oci_execute($stmt);
+}
+
+function dropxmltab($c) // delete table
+{
+ $stmt = oci_parse($c, "drop table bug43497_tab");
+ oci_execute($stmt);
+}
+
+
+function fillxmltab($c)
+{
+ for ($id = 1; $id <= 100; $id++) {
+
+ // create an XML element string with random data
+ $s = "<data>";
+ for ($j = 0; $j < 128; $j++) {
+ $s .= rand();
+ }
+ $s .= "</data>\n";
+ for ($j = 0; $j < 4; $j++) {
+ $s .= $s;
+ }
+ $data = "<?xml version=\"1.0\"?><records>" . $s . "</records>";
+
+ // insert XML data into database
+
+ $stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values (:id, sys.xmltype.createxml(:xml))");
+ oci_bind_by_name($stmt, ":id", $id);
+ $clob = oci_new_descriptor($c, OCI_D_LOB);
+ oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB);
+ $clob->writetemporary($data);
+ oci_execute($stmt);
+
+ $clob->close();
+ $clob->free();
+ }
+}
+
+
+// Initialize
+
+createxmltab($c);
+fillxmltab($c);
+
+// Run Test
+
+$sid = sessionid($c);
+
+echo "Explicit LOB use\n";
+for ($i = 1; $i <= 10; $i++) {
+ echo "\nRun = " . $i . "\n";
+ echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
+ readxmltab_ex($c);
+}
+
+echo "\nImplicit LOB use\n";
+for ($i = 1; $i <= 10; $i++) {
+ echo "\nRun = " . $i . "\n";
+ echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
+ readxmltab_im($c);
+}
+
+echo "\nExplicit LOB with no free (i.e. a temp lob leak)\n";
+for ($i = 1; $i <= 10; $i++) {
+ echo "\nRun = " . $i . "\n";
+ echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
+ readxmltab_ex_nofree($c);
+}
+
+
+
+// Cleanup
+
+dropxmltab($c);
+
+oci_close($c);
+
+echo "Done\n";
+?>
+--EXPECT--
+Explicit LOB use
+
+Run = 1
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 2
+Temporary LOBs = 100
+Loop count check = 100
+
+Run = 3
+Temporary LOBs = 200
+Loop count check = 100
+
+Run = 4
+Temporary LOBs = 300
+Loop count check = 100
+
+Run = 5
+Temporary LOBs = 400
+Loop count check = 100
+
+Run = 6
+Temporary LOBs = 500
+Loop count check = 100
+
+Run = 7
+Temporary LOBs = 600
+Loop count check = 100
+
+Run = 8
+Temporary LOBs = 700
+Loop count check = 100
+
+Run = 9
+Temporary LOBs = 800
+Loop count check = 100
+
+Run = 10
+Temporary LOBs = 900
+Loop count check = 100
+
+Implicit LOB use
+
+Run = 1
+Temporary LOBs = 1000
+Loop count check = 100
+
+Run = 2
+Temporary LOBs = 1100
+Loop count check = 100
+
+Run = 3
+Temporary LOBs = 1200
+Loop count check = 100
+
+Run = 4
+Temporary LOBs = 1300
+Loop count check = 100
+
+Run = 5
+Temporary LOBs = 1400
+Loop count check = 100
+
+Run = 6
+Temporary LOBs = 1500
+Loop count check = 100
+
+Run = 7
+Temporary LOBs = 1600
+Loop count check = 100
+
+Run = 8
+Temporary LOBs = 1700
+Loop count check = 100
+
+Run = 9
+Temporary LOBs = 1800
+Loop count check = 100
+
+Run = 10
+Temporary LOBs = 1900
+Loop count check = 100
+
+Explicit LOB with no free (i.e. a temp lob leak)
+
+Run = 1
+Temporary LOBs = 2000
+Loop count check = 100
+
+Run = 2
+Temporary LOBs = 2100
+Loop count check = 100
+
+Run = 3
+Temporary LOBs = 2200
+Loop count check = 100
+
+Run = 4
+Temporary LOBs = 2300
+Loop count check = 100
+
+Run = 5
+Temporary LOBs = 2400
+Loop count check = 100
+
+Run = 6
+Temporary LOBs = 2500
+Loop count check = 100
+
+Run = 7
+Temporary LOBs = 2600
+Loop count check = 100
+
+Run = 8
+Temporary LOBs = 2700
+Loop count check = 100
+
+Run = 9
+Temporary LOBs = 2800
+Loop count check = 100
+
+Run = 10
+Temporary LOBs = 2900
+Loop count check = 100
+Done \ No newline at end of file
diff --git a/ext/oci8/tests/bug44113.phpt b/ext/oci8/tests/bug44113.phpt
index 646f09b7c..d6c297863 100644
--- a/ext/oci8/tests/bug44113.phpt
+++ b/ext/oci8/tests/bug44113.phpt
@@ -5,7 +5,7 @@ Bug #44113 (New collection creation can fail with OCI-22303)
--FILE--
<?php
-require dirname(__FILE__).'/connect.inc';
+require(dirname(__FILE__).'/connect.inc');
// Initialization
@@ -22,8 +22,7 @@ foreach ($stmtarray as $stmt) {
// The test can take some time to complete and can exceed PHP's test
// timout limit on slow networks.
-for ($x = 0; $x < 70000; $x++)
-{
+for ($x = 0; $x < 70000; $x++) {
if (!($var = oci_new_collection($c, 'BUG44113_LIST_T'))) {
print "Failed new collection creation on $x\n";
break;
diff --git a/ext/oci8/tests/bug44206.phpt b/ext/oci8/tests/bug44206.phpt
index ebf31f715..e5771e418 100644
--- a/ext/oci8/tests/bug44206.phpt
+++ b/ext/oci8/tests/bug44206.phpt
@@ -5,25 +5,27 @@ Bug #44206 (Test if selecting ref cursors leads to ORA-1000 maximum open cursors
--FILE--
<?php
-require(dirname(__FILE__).'/connect.inc');
+require dirname(__FILE__).'/connect.inc';
// Run Test
-for ($x = 0; $x < 400; $x++) {
+for ($x = 0; $x < 400; $x++)
+{
$stmt = "select cursor (select $x from dual) a,
- cursor (select $x from dual) b
- from dual";
+ cursor (select $x from dual) b
+ from dual";
$s = oci_parse($c, $stmt);
$r = oci_execute($s);
- if (!$r) {
- echo "Exiting $x\n";
- exit;
- }
- $result = oci_fetch_array($s, OCI_ASSOC);
+ if (!$r) {
+ echo "Exiting $x\n";
+ exit;
+ }
+ $mode = OCI_ASSOC | OCI_RETURN_NULLS;
+ $result = oci_fetch_array($s, $mode);
oci_execute($result['A']);
oci_execute($result['B']);
- oci_fetch_array($result['A'], OCI_ASSOC);
- oci_fetch_array($result['B'], OCI_ASSOC);
+ oci_fetch_array($result['A'], $mode);
+ oci_fetch_array($result['B'], $mode);
oci_free_statement($result['A']);
oci_free_statement($result['B']);
oci_free_statement($s);
diff --git a/ext/oci8/tests/connect_scope1.phpt b/ext/oci8/tests/connect_scope1.phpt
new file mode 100644
index 000000000..d6d16f17e
--- /dev/null
+++ b/ext/oci8/tests/connect_scope1.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Test oci_connect end-of-scope when statement returned
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/details.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table connect_scope1_tab",
+ "create table connect_scope1_tab (c1 number)",
+);
+
+if (!empty($dbase))
+ $c1 = oci_new_connect($user,$password,$dbase);
+else
+ $c1 = oci_new_connect($user,$password);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ @oci_execute($s1);
+}
+
+// Run Test
+
+echo "Test 1 - oci_connect\n";
+
+function f()
+{
+ global $user, $password, $dbase;
+
+ if (!empty($dbase))
+ $c = oci_connect($user,$password,$dbase);
+ else
+ $c = oci_connect($user,$password);
+ $s = oci_parse($c, "insert into connect_scope1_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ return($s); // this keeps the connection refcount positive so the connection isn't closed
+}
+
+$s2 = f();
+
+// Check nothing committed yet
+
+$s1 = oci_parse($c1, "select * from connect_scope1_tab");
+oci_execute($s1, OCI_DEFAULT);
+oci_fetch_all($s1, $r);
+var_dump($r);
+
+// insert 2nd row on returned statement, committing both rows
+oci_execute($s2);
+
+// Verify data was committed
+
+$s1 = oci_parse($c1, "select * from connect_scope1_tab");
+oci_execute($s1);
+oci_fetch_all($s1, $r);
+var_dump($r);
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table connect_scope1_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ oci_execute($s1);
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1 - oci_connect
+array(1) {
+ ["C1"]=>
+ array(0) {
+ }
+}
+array(1) {
+ ["C1"]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ }
+}
+Done
diff --git a/ext/oci8/tests/connect_scope2.phpt b/ext/oci8/tests/connect_scope2.phpt
new file mode 100644
index 000000000..7017493f5
--- /dev/null
+++ b/ext/oci8/tests/connect_scope2.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Test oci_pconnect end-of-scope when statement returned
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/details.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table connect_scope2_tab",
+ "create table connect_scope2_tab (c1 number)",
+);
+
+if (!empty($dbase))
+ $c1 = oci_new_connect($user,$password,$dbase);
+else
+ $c1 = oci_new_connect($user,$password);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ @oci_execute($s1);
+}
+
+// Run Test
+
+echo "Test 1 - oci_pconnect\n";
+
+function f()
+{
+ global $user, $password, $dbase;
+
+ if (!empty($dbase))
+ $c = oci_pconnect($user,$password,$dbase);
+ else
+ $c = oci_pconnect($user,$password);
+ $s = oci_parse($c, "insert into connect_scope2_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ return($s); // this keeps the connection refcount positive so the connection isn't closed
+}
+
+$s2 = f();
+
+// Check nothing committed yet
+
+$s1 = oci_parse($c1, "select * from connect_scope2_tab");
+oci_execute($s1, OCI_DEFAULT);
+oci_fetch_all($s1, $r);
+var_dump($r);
+
+// insert 2nd row on returned statement, committing both rows
+oci_execute($s2);
+
+// Verify data was committed
+
+$s1 = oci_parse($c1, "select * from connect_scope2_tab");
+oci_execute($s1);
+oci_fetch_all($s1, $r);
+var_dump($r);
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table connect_scope2_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ oci_execute($s1);
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1 - oci_pconnect
+array(1) {
+ ["C1"]=>
+ array(0) {
+ }
+}
+array(1) {
+ ["C1"]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ }
+}
+Done
diff --git a/ext/oci8/tests/connect_scope_try1.phpt b/ext/oci8/tests/connect_scope_try1.phpt
new file mode 100644
index 000000000..a881ea6ea
--- /dev/null
+++ b/ext/oci8/tests/connect_scope_try1.phpt
@@ -0,0 +1,100 @@
+--TEST--
+Check oci_connect try/catch end-of-scope with old_oci_close_semantics Off
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=0
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/details.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table scope_try1_tab",
+ "create table scope_try1_tab (c1 number)"
+);
+
+if (!empty($dbase))
+ $c1 = oci_new_connect($user,$password,$dbase);
+else
+ $c1 = oci_new_connect($user,$password);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ @oci_execute($s1);
+}
+
+// Run Test
+
+echo "Test 1\n";
+
+// Make errors throw exceptions
+
+set_error_handler(create_function('$x, $y', 'throw new Exception($y, $x);'));
+
+try
+{
+ if (!empty($dbase))
+ $c = oci_connect($user,$password,$dbase);
+ else
+ $c = oci_connect($user,$password);
+ $s = oci_parse($c, "insert into scope_try1_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ $s = oci_parse($c, "insert into scope_try1_tab values (ABC)"); // syntax error -> throws exception
+ oci_execute($s, OCI_DEFAULT); // no commit
+}
+catch (Exception $e)
+{
+ echo "Caught Exception: ". $e->getMessage(), "\n";
+ var_dump($c);
+
+ // Verify data is not yet committed
+ $s1 = oci_parse($c1, "select * from scope_try1_tab");
+ oci_execute($s1);
+ oci_fetch_all($s1, $r);
+ var_dump($r);
+
+ // Now commit
+ oci_commit($c);
+}
+
+// Verify data was committed in the Catch block
+
+$s1 = oci_parse($c1, "select * from scope_try1_tab");
+oci_execute($s1);
+oci_fetch_all($s1, $r);
+var_dump($r);
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table scope_try1_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ oci_execute($s1);
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1
+Caught Exception: oci_execute(): ORA-00984: %s
+resource(%d) of type (oci8 connection)
+array(1) {
+ ["C1"]=>
+ array(0) {
+ }
+}
+array(1) {
+ ["C1"]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+}
+Done
diff --git a/ext/oci8/tests/connect_scope_try2.phpt b/ext/oci8/tests/connect_scope_try2.phpt
new file mode 100644
index 000000000..9e6b5ce2e
--- /dev/null
+++ b/ext/oci8/tests/connect_scope_try2.phpt
@@ -0,0 +1,100 @@
+--TEST--
+Check oci_connect try/catch end-of-scope with old_oci_close_semantics On
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=1
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/details.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table scope_try2_tab",
+ "create table scope_try2_tab (c1 number)"
+);
+
+if (!empty($dbase))
+ $c1 = oci_new_connect($user,$password,$dbase);
+else
+ $c1 = oci_new_connect($user,$password);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ @oci_execute($s1);
+}
+
+// Run Test
+
+echo "Test 1\n";
+
+// Make errors throw exceptions
+
+set_error_handler(create_function('$x, $y', 'throw new Exception($y, $x);'));
+
+try
+{
+ if (!empty($dbase))
+ $c = oci_connect($user,$password,$dbase);
+ else
+ $c = oci_connect($user,$password);
+ $s = oci_parse($c, "insert into scope_try2_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ $s = oci_parse($c, "insert into scope_try2_tab values (ABC)"); // syntax error -> throws exception
+ oci_execute($s, OCI_DEFAULT); // no commit
+}
+catch (Exception $e)
+{
+ echo "Caught Exception: ". $e->getMessage(), "\n";
+ var_dump($c);
+
+ // Verify data is not yet committed
+ $s1 = oci_parse($c1, "select * from scope_try2_tab");
+ oci_execute($s1);
+ oci_fetch_all($s1, $r);
+ var_dump($r);
+
+ // Now commit
+ oci_commit($c);
+}
+
+// Verify data was committed in the Catch block
+
+$s1 = oci_parse($c1, "select * from scope_try2_tab");
+oci_execute($s1);
+oci_fetch_all($s1, $r);
+var_dump($r);
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table scope_try2_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ oci_execute($s1);
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1
+Caught Exception: oci_execute(): ORA-00984: %s
+resource(%d) of type (oci8 connection)
+array(1) {
+ ["C1"]=>
+ array(0) {
+ }
+}
+array(1) {
+ ["C1"]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+}
+Done
diff --git a/ext/oci8/tests/connect_scope_try3.phpt b/ext/oci8/tests/connect_scope_try3.phpt
new file mode 100644
index 000000000..1cd44b021
--- /dev/null
+++ b/ext/oci8/tests/connect_scope_try3.phpt
@@ -0,0 +1,100 @@
+--TEST--
+Check oci_new_connect try/catch end-of-scope with old_oci_close_semantics Off
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=0
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/details.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table scope_try3_tab",
+ "create table scope_try3_tab (c1 number)"
+);
+
+if (!empty($dbase))
+ $c1 = oci_new_connect($user,$password,$dbase);
+else
+ $c1 = oci_new_connect($user,$password);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ @oci_execute($s1);
+}
+
+// Run Test
+
+echo "Test 1\n";
+
+// Make errors throw exceptions
+
+set_error_handler(create_function('$x, $y', 'throw new Exception($y, $x);'));
+
+try
+{
+ if (!empty($dbase))
+ $c = oci_new_connect($user,$password,$dbase);
+ else
+ $c = oci_new_connect($user,$password);
+ $s = oci_parse($c, "insert into scope_try3_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ $s = oci_parse($c, "insert into scope_try3_tab values (ABC)"); // syntax error -> throws exception
+ oci_execute($s, OCI_DEFAULT); // no commit
+}
+catch (Exception $e)
+{
+ echo "Caught Exception: ". $e->getMessage(), "\n";
+ var_dump($c);
+
+ // Verify data is not yet committed
+ $s1 = oci_parse($c1, "select * from scope_try3_tab");
+ oci_execute($s1);
+ oci_fetch_all($s1, $r);
+ var_dump($r);
+
+ // Now commit
+ oci_commit($c);
+}
+
+// Verify data was committed in the Catch block
+
+$s1 = oci_parse($c1, "select * from scope_try3_tab");
+oci_execute($s1);
+oci_fetch_all($s1, $r);
+var_dump($r);
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table scope_try3_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ oci_execute($s1);
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1
+Caught Exception: oci_execute(): ORA-00984: %s
+resource(%d) of type (oci8 connection)
+array(1) {
+ ["C1"]=>
+ array(0) {
+ }
+}
+array(1) {
+ ["C1"]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+}
+Done
diff --git a/ext/oci8/tests/connect_scope_try4.phpt b/ext/oci8/tests/connect_scope_try4.phpt
new file mode 100644
index 000000000..9b4cd1f27
--- /dev/null
+++ b/ext/oci8/tests/connect_scope_try4.phpt
@@ -0,0 +1,100 @@
+--TEST--
+Check oci_new_connect try/catch end-of-scope with old_oci_close_semantics On
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=1
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/details.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table scope_try4_tab",
+ "create table scope_try4_tab (c1 number)"
+);
+
+if (!empty($dbase))
+ $c1 = oci_new_connect($user,$password,$dbase);
+else
+ $c1 = oci_new_connect($user,$password);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ @oci_execute($s1);
+}
+
+// Run Test
+
+echo "Test 1\n";
+
+// Make errors throw exceptions
+
+set_error_handler(create_function('$x, $y', 'throw new Exception($y, $x);'));
+
+try
+{
+ if (!empty($dbase))
+ $c = oci_new_connect($user,$password,$dbase);
+ else
+ $c = oci_new_connect($user,$password);
+ $s = oci_parse($c, "insert into scope_try4_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ $s = oci_parse($c, "insert into scope_try4_tab values (ABC)"); // syntax error -> throws exception
+ oci_execute($s, OCI_DEFAULT); // no commit
+}
+catch (Exception $e)
+{
+ echo "Caught Exception: ". $e->getMessage(), "\n";
+ var_dump($c);
+
+ // Verify data is not yet committed
+ $s1 = oci_parse($c1, "select * from scope_try4_tab");
+ oci_execute($s1);
+ oci_fetch_all($s1, $r);
+ var_dump($r);
+
+ // Now commit
+ oci_commit($c);
+}
+
+// Verify data was committed in the Catch block
+
+$s1 = oci_parse($c1, "select * from scope_try4_tab");
+oci_execute($s1);
+oci_fetch_all($s1, $r);
+var_dump($r);
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table scope_try4_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ oci_execute($s1);
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1
+Caught Exception: oci_execute(): ORA-00984: %s
+resource(%d) of type (oci8 connection)
+array(1) {
+ ["C1"]=>
+ array(0) {
+ }
+}
+array(1) {
+ ["C1"]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+}
+Done
diff --git a/ext/oci8/tests/connect_scope_try5.phpt b/ext/oci8/tests/connect_scope_try5.phpt
new file mode 100644
index 000000000..121fb33dc
--- /dev/null
+++ b/ext/oci8/tests/connect_scope_try5.phpt
@@ -0,0 +1,100 @@
+--TEST--
+Check oci_pconnect try/catch end-of-scope with old_oci_close_semantics Off
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=0
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/details.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table scope_try5_tab",
+ "create table scope_try5_tab (c1 number)"
+);
+
+if (!empty($dbase))
+ $c1 = oci_new_connect($user,$password,$dbase);
+else
+ $c1 = oci_new_connect($user,$password);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ @oci_execute($s1);
+}
+
+// Run Test
+
+echo "Test 1\n";
+
+// Make errors throw exceptions
+
+set_error_handler(create_function('$x, $y', 'throw new Exception($y, $x);'));
+
+try
+{
+ if (!empty($dbase))
+ $c = oci_pconnect($user,$password,$dbase);
+ else
+ $c = oci_pconnect($user,$password);
+ $s = oci_parse($c, "insert into scope_try5_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ $s = oci_parse($c, "insert into scope_try5_tab values (ABC)"); // syntax error -> throws exception
+ oci_execute($s, OCI_DEFAULT); // no commit
+}
+catch (Exception $e)
+{
+ echo "Caught Exception: ". $e->getMessage(), "\n";
+ var_dump($c);
+
+ // Verify data is not yet committed
+ $s1 = oci_parse($c1, "select * from scope_try5_tab");
+ oci_execute($s1);
+ oci_fetch_all($s1, $r);
+ var_dump($r);
+
+ // Now commit
+ oci_commit($c);
+}
+
+// Verify data was committed in the Catch block
+
+$s1 = oci_parse($c1, "select * from scope_try5_tab");
+oci_execute($s1);
+oci_fetch_all($s1, $r);
+var_dump($r);
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table scope_try5_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ oci_execute($s1);
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1
+Caught Exception: oci_execute(): ORA-00984: %s
+resource(%d) of type (oci8 persistent connection)
+array(1) {
+ ["C1"]=>
+ array(0) {
+ }
+}
+array(1) {
+ ["C1"]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+}
+Done
diff --git a/ext/oci8/tests/connect_scope_try6.phpt b/ext/oci8/tests/connect_scope_try6.phpt
new file mode 100644
index 000000000..3347543ab
--- /dev/null
+++ b/ext/oci8/tests/connect_scope_try6.phpt
@@ -0,0 +1,100 @@
+--TEST--
+Check oci_pconnect try/catch end-of-scope with old_oci_close_semantics On
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=1
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/details.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table scope_try6_tab",
+ "create table scope_try6_tab (c1 number)"
+);
+
+if (!empty($dbase))
+ $c1 = oci_new_connect($user,$password,$dbase);
+else
+ $c1 = oci_new_connect($user,$password);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ @oci_execute($s1);
+}
+
+// Run Test
+
+echo "Test 1\n";
+
+// Make errors throw exceptions
+
+set_error_handler(create_function('$x, $y', 'throw new Exception($y, $x);'));
+
+try
+{
+ if (!empty($dbase))
+ $c = oci_pconnect($user,$password,$dbase);
+ else
+ $c = oci_pconnect($user,$password);
+ $s = oci_parse($c, "insert into scope_try6_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ $s = oci_parse($c, "insert into scope_try6_tab values (ABC)"); // syntax error -> throws exception
+ oci_execute($s, OCI_DEFAULT); // no commit
+}
+catch (Exception $e)
+{
+ echo "Caught Exception: ". $e->getMessage(), "\n";
+ var_dump($c);
+
+ // Verify data is not yet committed
+ $s1 = oci_parse($c1, "select * from scope_try6_tab");
+ oci_execute($s1);
+ oci_fetch_all($s1, $r);
+ var_dump($r);
+
+ // Now commit
+ oci_commit($c);
+}
+
+// Verify data was committed in the Catch block
+
+$s1 = oci_parse($c1, "select * from scope_try6_tab");
+oci_execute($s1);
+oci_fetch_all($s1, $r);
+var_dump($r);
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table scope_try6_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s1 = oci_parse($c1, $stmt);
+ oci_execute($s1);
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1
+Caught Exception: oci_execute(): ORA-00984: %s
+resource(%d) of type (oci8 persistent connection)
+array(1) {
+ ["C1"]=>
+ array(0) {
+ }
+}
+array(1) {
+ ["C1"]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+}
+Done
diff --git a/ext/oci8/tests/drcp_characterset.phpt b/ext/oci8/tests/drcp_characterset.phpt
new file mode 100644
index 000000000..657d4c5ba
--- /dev/null
+++ b/ext/oci8/tests/drcp_characterset.phpt
@@ -0,0 +1,61 @@
+--TEST--
+DRCP: oci_pconnect() and oci_connect() with different character sets
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/details.inc";
+
+// Create connections with oci_connect and oci_pconnect with UTF8 as Charset
+
+$c1 = oci_connect($user,$password,$dbase,"UTF8");
+var_dump($c1);
+
+// Now with oci_pconnect()
+
+$p1 = oci_pconnect($user,$password,$dbase,"UTF8");
+var_dump($p1);
+
+// Create two more connections with character set US7ASCII
+
+$c2 = oci_connect($user,$password,$dbase,"US7ASCII");
+var_dump($c2);
+
+// Now with oci_pconnect()
+
+$p2 = oci_pconnect($user,$password,$dbase,"US7ASCII");
+var_dump($p2);
+
+// The two connections c1 and c2 should not share resources as they use different
+//character sets
+
+if((int)$c1 === (int)$c2)
+ echo "First and third connections share a resource: NOT OK\n";
+else
+ echo "First and third connections are different: OK\n";
+
+// The two connections p1 and p2 should not share resources as they use different
+//character sets
+
+if((int)$p1 === (int)$p2)
+ echo "Second and fourth connections share a resource: NOT OK\n";
+else
+ echo "Second and fourth connections are different: OK\n";
+
+// Close all the connections
+oci_close($c1);
+oci_close($c2);
+oci_close($p1);
+oci_close($p2);
+
+echo "Done\n";
+?>
+--EXPECTF--
+resource(%d) of type (oci8 connection)
+resource(%d) of type (oci8 persistent connection)
+resource(%d) of type (oci8 connection)
+resource(%d) of type (oci8 persistent connection)
+First and third connections are different: OK
+Second and fourth connections are different: OK
+Done
diff --git a/ext/oci8/tests/drcp_conn_close1.phpt b/ext/oci8/tests/drcp_conn_close1.phpt
new file mode 100644
index 000000000..697b7e357
--- /dev/null
+++ b/ext/oci8/tests/drcp_conn_close1.phpt
@@ -0,0 +1,45 @@
+--TEST--
+DRCP: oci_connect() with oci_close() and oci8.old_oci_close_semantics ON
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=1
+oci8.connection_class=test
+--FILE--
+<?php
+
+require dirname(__FILE__)."/details.inc";
+
+// Test will open a connection
+// Close the connection
+// Open another connection
+// With oci_close() being a no-op, the same conneciton will be returned
+
+
+echo "This is with a OCI_CONNECT\n";
+var_dump($conn1 = oci_connect($user,$password,$dbase));
+$rn1 = (int)$conn1;
+oci_close($conn1);
+
+// Open another connection
+
+var_dump($conn2 = oci_connect($user,$password,$dbase));
+$rn2 = (int)$conn2;
+oci_close($conn2);
+
+// Compare the resource numbers
+
+if ($rn1 === $rn2)
+ echo "Both connections share a resource : OK \n";
+else
+ echo "Both connections are different : NOT OK \n";
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+This is with a OCI_CONNECT
+resource(%d) of type (oci8 connection)
+resource(%d) of type (oci8 connection)
+Both connections share a resource : OK
+Done
diff --git a/ext/oci8/tests/drcp_conn_close2.phpt b/ext/oci8/tests/drcp_conn_close2.phpt
new file mode 100644
index 000000000..0d3f8247f
--- /dev/null
+++ b/ext/oci8/tests/drcp_conn_close2.phpt
@@ -0,0 +1,46 @@
+--TEST--
+DRCP: oci_connect() with oci_close() and oci8.old_oci_close_semantics OFF
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=0
+oci8.connection_class=test
+--FILE--
+<?php
+
+require dirname(__FILE__)."/details.inc";
+
+// Test will open a connection
+// Close the connection
+// Open another connection
+// With oci_close() the connection is released to the pool and hence the
+// the second conneciton will be different
+
+
+// OCI_CONNECT
+echo "This is with a OCI_CONNECT\n";
+var_dump($conn1 = oci_connect($user,$password,$dbase));
+$rn1 = (int)$conn1;
+oci_close($conn1);
+
+// Open another connection
+var_dump($conn2 = oci_connect($user,$password,$dbase));
+$rn2 = (int)$conn2;
+oci_close($conn2);
+
+// Compare the resource numbers
+
+if ($rn1 === $rn2)
+ echo "Both connections share a resource : NOT OK \n";
+else
+ echo "Both connections are different : OK \n";
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+This is with a OCI_CONNECT
+resource(%d) of type (oci8 connection)
+resource(%d) of type (oci8 connection)
+Both connections are different : OK
+Done
diff --git a/ext/oci8/tests/drcp_connect1.phpt b/ext/oci8/tests/drcp_connect1.phpt
new file mode 100644
index 000000000..bf619a4ef
--- /dev/null
+++ b/ext/oci8/tests/drcp_connect1.phpt
@@ -0,0 +1,86 @@
+--TEST--
+DRCP: oci_connect()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.connection_class=test
+oci8.old_oci_close_semantics=0
+--FILE--
+<?php
+
+require dirname(__FILE__)."/details.inc";
+require dirname(__FILE__)."/drcp_functions.inc";
+
+// Open a number of connections with oci_connect and oci_pconnect and verify
+// whether we get a used session with DRCP.
+// To verify this, we change the value of a PL/SQL package variable in one
+// session and query for this through another connection
+
+var_dump($conn1 = oci_connect($user,$password,$dbase));
+// Create the package
+drcp_create_package($conn1);
+
+// OCI_CONNECT
+echo " This is with OCI_CONNECT.....\n";
+drcp_select_packagevar($conn1); // Returns 0
+drcp_set_packagevar($conn1,1000);
+oci_close($conn1);
+echo " Connection conn1 closed....\n";
+
+// Second connection should return 0 for the package variable.
+var_dump($conn2 = oci_connect($user,$password,$dbase));
+echo " Select with connection 2 \n";
+drcp_select_packagevar($conn2); // Returns 0
+drcp_set_packagevar($conn2,100);
+
+// Third connection. There is no oci_close() for conn2 hence this should
+// return the value set by conn2.
+var_dump($conn3 = oci_connect($user,$password,$dbase));
+echo " Select with connection 3 \n";
+drcp_select_packagevar($conn3); // Returns 100
+
+// Close all the connections
+oci_close($conn2);
+oci_close($conn3);
+
+// OCI_PCONNECT
+echo "\n This is with oci_pconnect().....\n";
+var_dump($pconn1 = oci_pconnect($user,$password,$dbase));
+drcp_set_packagevar($pconn1,1000);
+oci_close($pconn1);
+echo " Connection pconn1 closed....\n";
+
+// Second connection with oci_pconnect should return the same session hence the
+// value returned is what is set by pconn1
+
+var_dump($pconn2 = oci_pconnect($user,$password,$dbase));
+echo " Select with persistent connection 2 \n";
+drcp_select_packagevar($pconn2); // Returns 1000
+oci_close($pconn2);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%d) of type (oci8 connection)
+ This is with OCI_CONNECT.....
+ The value of the package variable is 0
+ Package variable value set to 1000
+ Connection conn1 closed....
+resource(%d) of type (oci8 connection)
+ Select with connection 2
+ The value of the package variable is 0
+ Package variable value set to 100
+resource(%d) of type (oci8 connection)
+ Select with connection 3
+ The value of the package variable is 100
+
+ This is with oci_pconnect().....
+resource(%d) of type (oci8 persistent connection)
+ Package variable value set to 1000
+ Connection pconn1 closed....
+resource(%d) of type (oci8 persistent connection)
+ Select with persistent connection 2
+ The value of the package variable is 1000
+Done
+
diff --git a/ext/oci8/tests/drcp_functions.inc b/ext/oci8/tests/drcp_functions.inc
new file mode 100644
index 000000000..26adb21f3
--- /dev/null
+++ b/ext/oci8/tests/drcp_functions.inc
@@ -0,0 +1,93 @@
+<?php
+
+/* This file contains functions required by the DRCP tests */
+
+function drcp_create_table($conn)
+{
+ $create_sql = "CREATE TABLE DRCPTEST (id NUMBER, name VARCHAR2(10), dept VARCHAR2(10))";
+ $statement = oci_parse($conn, $create_sql);
+ oci_execute($statement);
+
+ $id_values = array(100,101,102,103,104,105,106,107,108);
+ $name_values = array("WIILIAMS","JOHN","SMITH","JONES","ADAMS","ROBERT",
+ "BILL","LAWSON","MARY");
+ $dept_values = array("ACCOUNTS","HR","HR","ADMIN","ACCOUNTS","HR",
+ "ACCOUNTS","HR","ACCOUNTS");
+ for($i=0; $i<8; $i++) {
+ $insert = "INSERT INTO DRCPTEST VALUES('".$id_values[$i]."','". $name_values[$i]."','".$dept_values[$i]."')";
+ $s = oci_parse($conn, $insert);
+ oci_execute($s);
+ }
+}
+
+function drcp_drop_table($conn)
+{
+ $ora_sql = "DROP TABLE DRCPTEST";
+ $statement = oci_parse($conn, $ora_sql);
+ oci_execute($statement);
+}
+
+function drcp_update_table($conn)
+{
+ $update_stmt ="Update drcptest set dept ='NEWDEPT' where id = 105";
+ $s1 = oci_parse($conn,$update_stmt);
+ oci_execute($s1,OCI_DEFAULT);
+ echo "Update done-- DEPT value has been set to NEWDEPT\n";
+}
+
+function drcp_select_value($conn)
+{
+ $sel_stmt="select dept from drcptest where id=105";
+ $s2 = oci_parse($conn,$sel_stmt);
+ oci_execute($s2,OCI_DEFAULT);
+ while(oci_fetch($s2)) {
+ echo "The value of DEPT for id 105 is ".oci_result($s2,1)."\n";
+ }
+}
+
+function drcp_select_packagevar($conn)
+{
+ $sel_stmt="select drcp_test_package.f1 as f1 from dual";
+ $s2 = oci_parse($conn, $sel_stmt);
+ oci_define_by_name($s2,'f1',$ret_num);
+ oci_execute($s2);
+ while(oci_fetch($s2)) {
+ echo " The value of the package variable is ".oci_result($s2,1)."\n";
+ }
+}
+
+
+function drcp_set_packagevar($conn,$num)
+{
+ $set_stmt = "begin drcp_test_package.p1($num); end;";
+ $s1 = oci_parse($conn,$set_stmt);
+ oci_execute($s1);
+ echo " Package variable value set to " .$num."\n";
+}
+
+function drcp_create_package($c)
+{
+ $create_package_stmt = "create or replace package drcp_test_package as
+ var int :=0;
+ procedure p1(var1 int);
+ function f1 return number;
+ end;";
+ $s1 = oci_parse($c, $create_package_stmt);
+ oci_execute($s1);
+
+ $package_body = "create or replace package body drcp_test_package as
+ procedure p1(var1 int) is
+ begin
+ var :=var1;
+ end;
+ function f1 return number is
+ begin
+ return drcp_test_package.var;
+ end;
+ end;";
+
+ $s2 = oci_parse($c, $package_body);
+ oci_execute($s2);
+}
+
+?>
diff --git a/ext/oci8/tests/drcp_newconnect.phpt b/ext/oci8/tests/drcp_newconnect.phpt
new file mode 100644
index 000000000..79718f4ee
--- /dev/null
+++ b/ext/oci8/tests/drcp_newconnect.phpt
@@ -0,0 +1,43 @@
+--TEST--
+DRCP: oci_new_connect()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.connection_class=test
+oci8.old_oci_close_semantics=0
+--FILE--
+<?php
+
+require dirname(__FILE__)."/details.inc";
+
+// Open two connections with oci_new_connect
+// Verify they are different by comparing the resource ids
+
+var_dump($c1 = oci_new_connect($user,$password,$dbase));
+$rn1 = (int)$c1;
+
+// Another connection now
+
+var_dump($c2 = oci_new_connect($user,$password,$dbase));
+$rn2 = (int)$c2;
+
+// rn1 and rn2 should be different.
+
+if ($rn1 === $rn2)
+ echo "First and second connections share a resource: Not OK\n";
+else
+ echo "First and second connections are different OK\n";
+
+// Close the connections
+oci_close($c1);
+oci_close($c2);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%d) of type (oci8 connection)
+resource(%d) of type (oci8 connection)
+First and second connections are different OK
+Done
+
diff --git a/ext/oci8/tests/drcp_pconn_close1.phpt b/ext/oci8/tests/drcp_pconn_close1.phpt
new file mode 100644
index 000000000..a9b912b26
--- /dev/null
+++ b/ext/oci8/tests/drcp_pconn_close1.phpt
@@ -0,0 +1,44 @@
+--TEST--
+DRCP: oci_pconnect() with oci_close() and oci8.old_oci_close_semantics ON
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=1
+oci8.connection_class=test
+--FILE--
+<?php
+
+require dirname(__FILE__)."/details.inc";
+
+// Test will open a persistent connection
+// Close the connection
+// Open another connection
+// With oci_close() being a no-op, the same conneciton will be returned
+
+echo "This is with a OCI_PCONNECT\n";
+var_dump($conn1 = oci_pconnect($user,$password,$dbase));
+$rn1 = (int)$conn1;
+oci_close($conn1);
+
+// Open another connection
+
+var_dump($conn2 = oci_pconnect($user,$password,$dbase));
+$rn2 = (int)$conn2;
+oci_close($conn2);
+
+// Compare the resource numbers
+
+if ($rn1 === $rn2)
+ echo "Both connections share a resource : OK \n";
+else
+ echo "Both connections are different : NOT OK \n";
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+This is with a OCI_PCONNECT
+resource(%d) of type (oci8 persistent connection)
+resource(%d) of type (oci8 persistent connection)
+Both connections share a resource : OK
+Done
diff --git a/ext/oci8/tests/drcp_pconn_close2.phpt b/ext/oci8/tests/drcp_pconn_close2.phpt
new file mode 100644
index 000000000..5fd2c2355
--- /dev/null
+++ b/ext/oci8/tests/drcp_pconn_close2.phpt
@@ -0,0 +1,46 @@
+--TEST--
+DRCP: oci_pconnect() with oci_close() and oci8.old_oci_close_semantics OFF
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=0
+oci8.connection_class=test
+--FILE--
+<?php
+
+require dirname(__FILE__)."/details.inc";
+
+// Test will open a persistent connection
+// Close the connection
+// Open another connection
+// With oci_close() the connection is released to the pool and hence the
+// the second connection will be different
+
+
+echo "This is with a OCI_PCONNECT\n";
+var_dump($conn1 = oci_pconnect($user,$password,$dbase));
+$rn1 = (int)$conn1;
+oci_close($conn1);
+
+// Query for the row updated. The new value should be returned
+
+var_dump($conn2 = oci_pconnect($user,$password,$dbase));
+$rn2 = (int)$conn2;
+oci_close($conn2);
+
+// Compare the resource numbers
+
+if ($rn1 === $rn2)
+ echo "Both connections share a resource : NOT OK \n";
+else
+ echo "Both connections are different : OK \n";
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+This is with a OCI_PCONNECT
+resource(%d) of type (oci8 persistent connection)
+resource(%d) of type (oci8 persistent connection)
+Both connections are different : OK
+Done
diff --git a/ext/oci8/tests/drcp_privileged.phpt b/ext/oci8/tests/drcp_privileged.phpt
new file mode 100644
index 000000000..9af20625e
--- /dev/null
+++ b/ext/oci8/tests/drcp_privileged.phpt
@@ -0,0 +1,47 @@
+--TEST--
+DRCP: privileged connect
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
+require(dirname(__FILE__)."/details.inc");
+if (empty($oracle_on_localhost)) die("skip this test is unlikely to work with remote Oracle - unless an Oracle password file has been created");
+?>
+--INI--
+oci8.privileged_connect=1
+--FILE--
+<?php
+
+// Connecting as SYSDBA or SYSOPER through DRCP will give ORA-1031
+
+require dirname(__FILE__)."/details.inc";
+var_dump(oci_connect($user,$password,$dbase,false,OCI_SYSDBA));
+var_dump(oci_connect($user,$password,$dbase,false,OCI_SYSOPER));
+var_dump(oci_new_connect($user,$password,$dbase,false,OCI_SYSDBA));
+var_dump(oci_new_connect($user,$password,$dbase,false,OCI_SYSOPER));
+var_dump(oci_pconnect($user,$password,$dbase,false,OCI_SYSDBA));
+var_dump(oci_pconnect($user,$password,$dbase,false,OCI_SYSOPER));
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Warning: oci_connect(): ORA-01031: insufficient privileges in %s on line %d
+bool(false)
+
+Warning: oci_connect(): ORA-01031: insufficient privileges in %s on line %d
+bool(false)
+
+Warning: oci_new_connect(): ORA-01031: insufficient privileges in %s on line %d
+bool(false)
+
+Warning: oci_new_connect(): ORA-01031: insufficient privileges in %s on line %d
+bool(false)
+
+Warning: oci_pconnect(): ORA-01031: insufficient privileges in %s on line %d
+bool(false)
+
+Warning: oci_pconnect(): ORA-01031: insufficient privileges in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/oci8/tests/drcp_scope1.phpt b/ext/oci8/tests/drcp_scope1.phpt
new file mode 100644
index 000000000..57f1abe32
--- /dev/null
+++ b/ext/oci8/tests/drcp_scope1.phpt
@@ -0,0 +1,92 @@
+--TEST--
+DRCP: oci_new_connect() and oci_connect() with scope end when oci8.old_oci_close_semantics ON
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=1
+--FILE--
+<?php
+
+require dirname(__FILE__)."/drcp_functions.inc";
+require dirname(__FILE__)."/details.inc";
+
+// Scope considered here is the functional scope
+// Test will open a connection within a function (function 1).
+// Update a table
+// Open another connection from function 2.
+// When the scope ends the txn is rolled back and hence the updated value
+// will not be reflected for oci_connect and oci_new_connect.
+
+// Create the table
+$c = oci_new_connect($user,$password,$dbase);
+@drcp_drop_table($c);
+drcp_create_table($c);
+
+// OCI_NEW_CONNECT
+$conn_type = 1;
+echo "This is with a OCI_NEW_CONNECT\n";
+function1($user,$password,$dbase,$conn_type);
+
+// Should return the OLD value
+function2($user,$password,$dbase,$conn_type);
+
+// OCI_CONNECT
+$conn_type = 2;
+echo "\n\nThis is with a OCI_CONNECT\n";
+function1($user,$password,$dbase,$conn_type);
+
+// Should return the OLD value
+function2($user,$password,$dbase,$conn_type);
+
+//This is the first scope for the script
+
+function function1($user,$password,$dbase,$conn_type)
+{
+ switch($conn_type)
+ {
+ case 1:
+ var_dump($conn1 = oci_new_connect($user,$password,$dbase));
+ break;
+ case 2:
+ var_dump($conn1 = oci_connect($user,$password,$dbase));
+ break;
+ }
+ drcp_update_table($conn1);
+}
+
+// This is the second scope
+
+function function2($user,$password,$dbase,$conn_type)
+{
+ switch($conn_type)
+ {
+ case 1:
+ var_dump($conn1 = oci_new_connect($user,$password,$dbase));
+ break;
+ case 2:
+ var_dump($conn1 = oci_connect($user,$password,$dbase));
+ break;
+ }
+ drcp_select_value($conn1);
+}
+
+drcp_drop_table($c);
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+This is with a OCI_NEW_CONNECT
+resource(%d) of type (oci8 connection)
+Update done-- DEPT value has been set to NEWDEPT
+resource(%d) of type (oci8 connection)
+The value of DEPT for id 105 is HR
+
+
+This is with a OCI_CONNECT
+resource(%d) of type (oci8 connection)
+Update done-- DEPT value has been set to NEWDEPT
+resource(%d) of type (oci8 connection)
+The value of DEPT for id 105 is HR
+Done
diff --git a/ext/oci8/tests/drcp_scope2.phpt b/ext/oci8/tests/drcp_scope2.phpt
new file mode 100644
index 000000000..b72e00dbb
--- /dev/null
+++ b/ext/oci8/tests/drcp_scope2.phpt
@@ -0,0 +1,91 @@
+--TEST--
+DRCP: oci_new_connect() and oci_connect with scope end when oci8.old_oci_close_semantics OFF
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=0
+--FILE--
+<?php
+
+require dirname(__FILE__)."/drcp_functions.inc";
+require dirname(__FILE__)."/details.inc";
+
+// Scope considered here is the functional scope
+// Test will open a connection within a function (function 1).
+// Update a table
+// Open another connection from function 2.
+// When the scope ends the txn is rolled back and hence the updated value
+// will not be reflected for oci_connect and oci_new_connect.
+
+// Create the table
+$c = oci_new_connect($user,$password,$dbase);
+@drcp_drop_table($c);
+drcp_create_table($c);
+
+// OCI_NEW_CONNECT
+$conn_type = 1;
+echo "This is with a OCI_NEW_CONNECT\n";
+function1($user,$password,$dbase,$conn_type);
+
+// Should return the OLD value
+function2($user,$password,$dbase,$conn_type);
+
+// OCI_CONNECT
+$conn_type = 2;
+echo "\n\nThis is with a OCI_CONNECT\n";
+function1($user,$password,$dbase,$conn_type);
+
+// Should return the OLD value
+function2($user,$password,$dbase,$conn_type);
+
+//This is the first scope for the script
+
+function function1($user,$password,$dbase,$conn_type)
+{
+ switch($conn_type)
+ {
+ case 1:
+ var_dump($conn1 = oci_new_connect($user,$password,$dbase));
+ break;
+ case 2:
+ var_dump($conn1 = oci_connect($user,$password,$dbase));
+ break;
+ }
+ drcp_update_table($conn1);
+}
+
+// This is the second scope
+
+function function2($user,$password,$dbase,$conn_type)
+{
+ switch($conn_type)
+ {
+ case 1:
+ var_dump($conn1 = oci_new_connect($user,$password,$dbase));
+ break;
+ case 2:
+ var_dump($conn1 = oci_connect($user,$password,$dbase));
+ break;
+ }
+ drcp_select_value($conn1);
+}
+drcp_drop_table($c);
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+This is with a OCI_NEW_CONNECT
+resource(%d) of type (oci8 connection)
+Update done-- DEPT value has been set to NEWDEPT
+resource(%d) of type (oci8 connection)
+The value of DEPT for id 105 is HR
+
+
+This is with a OCI_CONNECT
+resource(%d) of type (oci8 connection)
+Update done-- DEPT value has been set to NEWDEPT
+resource(%d) of type (oci8 connection)
+The value of DEPT for id 105 is HR
+Done
diff --git a/ext/oci8/tests/drcp_scope3.phpt b/ext/oci8/tests/drcp_scope3.phpt
new file mode 100644
index 000000000..b448a518a
--- /dev/null
+++ b/ext/oci8/tests/drcp_scope3.phpt
@@ -0,0 +1,61 @@
+--TEST--
+DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics ON
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=1
+--FILE--
+<?php
+
+require dirname(__FILE__)."/drcp_functions.inc";
+require dirname(__FILE__)."/details.inc";
+
+// The test opens a connection within function1 and updates a table
+// (without committing). Another connection is opened from function
+// 2, and the table queried. When function1 ends, the connection from
+// function1 is not closed, so the updated value will be seen in
+// function2. Also the table can't be dropped because an uncommitted
+// transaction exists.
+
+// Create the table
+$c = oci_new_connect($user,$password,$dbase);
+@drcp_drop_table($c);
+drcp_create_table($c);
+
+echo "This is with a OCI_PCONNECT\n";
+function1($user,$password,$dbase);
+
+// Should return the OLD value
+function2($user,$password,$dbase);
+
+// This is the first scope for the script
+
+function function1($user,$password,$dbase)
+{
+ var_dump($c = oci_pconnect($user,$password,$dbase));
+ drcp_update_table($c);
+}
+
+// This is the second scope
+
+function function2($user,$password,$dbase)
+{
+ var_dump($c = oci_pconnect($user,$password,$dbase));
+ drcp_select_value($c);
+}
+
+drcp_drop_table($c);
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+This is with a OCI_PCONNECT
+resource(%d) of type (oci8 persistent connection)
+Update done-- DEPT value has been set to NEWDEPT
+resource(%d) of type (oci8 persistent connection)
+The value of DEPT for id 105 is NEWDEPT
+
+Warning: oci_execute(): ORA-00054: %s
+Done \ No newline at end of file
diff --git a/ext/oci8/tests/drcp_scope4.phpt b/ext/oci8/tests/drcp_scope4.phpt
new file mode 100644
index 000000000..182704b67
--- /dev/null
+++ b/ext/oci8/tests/drcp_scope4.phpt
@@ -0,0 +1,62 @@
+--TEST--
+DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics OFF
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=0
+--FILE--
+<?php
+
+require dirname(__FILE__)."/drcp_functions.inc";
+require dirname(__FILE__)."/details.inc";
+
+// The expected behavior of this test is different between PHP 5.2 and
+// PHP 5.3
+//
+// In PHP 5.2, the test opens a connection within function1 and
+// updates a table (without committing). Another connection is opened
+// from function 2, and the table queried. The connections should
+// share the same resource, so the new data is visible in function2.
+
+// Create the table
+$c = oci_new_connect($user,$password,$dbase);
+@drcp_drop_table($c);
+drcp_create_table($c);
+
+echo "This is with a OCI_PCONNECT\n";
+function1($user,$password,$dbase);
+
+// Should return the OLD value
+function2($user,$password,$dbase);
+
+// This is the first scope for the script
+
+function function1($user,$password,$dbase)
+{
+ var_dump($c = oci_pconnect($user,$password,$dbase));
+ drcp_update_table($c);
+}
+
+// This is the second scope
+
+function function2($user,$password,$dbase)
+{
+ var_dump($c = oci_pconnect($user,$password,$dbase));
+ drcp_select_value($c);
+}
+
+drcp_drop_table($c);
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+This is with a OCI_PCONNECT
+resource(%d) of type (oci8 persistent connection)
+Update done-- DEPT value has been set to NEWDEPT
+resource(%d) of type (oci8 persistent connection)
+The value of DEPT for id 105 is NEWDEPT
+
+Warning: oci_execute(): ORA-00054: %s
+Done
diff --git a/ext/oci8/tests/drcp_scope5.phpt b/ext/oci8/tests/drcp_scope5.phpt
new file mode 100644
index 000000000..832e6aa8c
--- /dev/null
+++ b/ext/oci8/tests/drcp_scope5.phpt
@@ -0,0 +1,63 @@
+--TEST--
+DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics ON
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=1
+--FILE--
+<?php
+
+require dirname(__FILE__)."/drcp_functions.inc";
+require dirname(__FILE__)."/details.inc";
+
+// Similar to drcp_scope3.phpt but does a commit before end of
+// function2, allowing the table to be dropped cleanly at the end.
+
+// The test opens a connection within function1 and updates a table
+// (without committing). Another connection is opened from function
+// 2, and the table queried. When function1 ends, the connection from
+// function1 is not closed, so the updated value will be seen in
+// function2. Also the table can't be dropped because an uncommitted
+// transaction exists.
+
+// Create the table
+$c = oci_new_connect($user,$password,$dbase);
+@drcp_drop_table($c);
+drcp_create_table($c);
+
+echo "This is with a OCI_PCONNECT\n";
+function1($user,$password,$dbase);
+
+// Should return the OLD value
+function2($user,$password,$dbase);
+
+// This is the first scope for the script
+
+function function1($user,$password,$dbase)
+{
+ var_dump($c = oci_pconnect($user,$password,$dbase));
+ drcp_update_table($c);
+}
+
+// This is the second scope
+
+function function2($user,$password,$dbase)
+{
+ var_dump($c = oci_pconnect($user,$password,$dbase));
+ drcp_select_value($c);
+ oci_commit($c);
+}
+
+drcp_drop_table($c);
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+This is with a OCI_PCONNECT
+resource(%d) of type (oci8 persistent connection)
+Update done-- DEPT value has been set to NEWDEPT
+resource(%d) of type (oci8 persistent connection)
+The value of DEPT for id 105 is NEWDEPT
+Done \ No newline at end of file
diff --git a/ext/oci8/tests/lob_042.phpt b/ext/oci8/tests/lob_042.phpt
index d79b4846e..25309d6fc 100644
--- a/ext/oci8/tests/lob_042.phpt
+++ b/ext/oci8/tests/lob_042.phpt
@@ -5,8 +5,6 @@ Check various LOB error messages
--FILE--
<?php
-// test some LOB error messages
-
require(dirname(__FILE__).'/connect.inc');
require(dirname(__FILE__).'/create_table.inc');
diff --git a/ext/oci8/tests/minfo.phpt b/ext/oci8/tests/minfo.phpt
new file mode 100644
index 000000000..f6b95ff29
--- /dev/null
+++ b/ext/oci8/tests/minfo.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Code coverage for PHP_MINFO_FUNCTION(oci)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+ob_start();
+phpinfo(INFO_MODULES);
+$v = ob_get_clean();
+$r = strpos($v, 'OCI8 Support => enabled');
+var_dump($r);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+int(%d)
+Done
diff --git a/ext/oci8/tests/password.phpt b/ext/oci8/tests/password.phpt
index a31843cfd..2741f9d3b 100644
--- a/ext/oci8/tests/password.phpt
+++ b/ext/oci8/tests/password.phpt
@@ -1,24 +1,74 @@
--TEST--
-oci_password_change()
+oci_password_change() for non-persistent connections
--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 (empty($dbase)) die ("skip requires database connection string be set");
+if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
+?>
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
+require(dirname(__FILE__)."/details.inc");
+
+// Create a user we can stuff around with and not affect subsequent tests
+$c0 = oci_connect($user, $password, $dbase);
+$stmts = array(
+ "drop user testuser",
+ "begin
+ execute immediate 'create user testuser identified by testuserpwd';
+ execute immediate 'grant connect, create session to testuser';
+ end;");
+foreach ($stmts as $sql) {
+ $s = oci_parse($c0, $sql);
+ @oci_execute($s);
+}
+
+// Connect and change the password
+$c1 = oci_connect("testuser", "testuserpwd", $dbase);
+var_dump($c1);
+$rn1 = (int)$c1;
+
+oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2");
-$new_password = "test";
-var_dump(oci_password_change($dbase, $user, $password, $new_password));
+// Second connect should return a new resource because the hash string will be different from $c1
+$c2 = oci_connect("testuser", "testuserpwd2", $dbase);
+var_dump($c2);
+$rn2 = (int)$c2;
+
+// Despite using the old password this connect should succeed and return the original resource
+$c3 = oci_connect("testuser", "testuserpwd", $dbase);
+var_dump($c3);
+$rn3 = (int)$c3;
+
+// Connections should differ
+if ($rn1 == $rn2) {
+ echo "First and second connections share a resource: Not OK\n";
+ var_dump($c1);
+}
+else {
+ echo "First and second connections are different: OK\n";
+}
-if (!empty($dbase)) {
- var_dump($new_c = ocilogon($user,$new_password,$dbase));
+// Connections should be the same
+if ($rn1 == $rn3) {
+ echo "First and third connections share a resource: OK\n";
}
else {
- var_dump($new_c = ocilogon($user,$new_password));
+ echo "First and third connections are different: Not OK\n";
+ var_dump($c1);
+ var_dump($c2);
}
-var_dump(oci_password_change($dbase, $user, $new_password, $password));
+// Clean up
+oci_close($c1);
+oci_close($c2);
+oci_close($c3);
+// Clean up
+$s = oci_parse($c0, "drop user cascade testuser");
+@oci_execute($s);
echo "Done\n";
@@ -27,4 +77,6 @@ echo "Done\n";
resource(%d) of type (oci8 connection)
resource(%d) of type (oci8 connection)
resource(%d) of type (oci8 connection)
+First and second connections are different: OK
+First and third connections share a resource: OK
Done
diff --git a/ext/oci8/tests/password_2.phpt b/ext/oci8/tests/password_2.phpt
index be5cb8540..9b6c09afb 100644
--- a/ext/oci8/tests/password_2.phpt
+++ b/ext/oci8/tests/password_2.phpt
@@ -4,6 +4,7 @@ oci_password_change() for persistent connections
<?php
if (!extension_loaded('oci8')) die("skip no oci8 extension");
require(dirname(__FILE__)."/details.inc");
+if (empty($dbase)) die ("skip requires database connection string be set");
if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
?>
--FILE--
@@ -27,34 +28,19 @@ foreach ($stmts as $sql) {
// Connect (persistent) and change the password
$c1 = oci_pconnect("testuser", "testuserpwd", $dbase);
var_dump($c1);
-
-ob_start();
-var_dump($c1);
-$r1 = ob_get_clean();
-preg_match("/resource\(([0-9])\) of.*/", $r1, $matches);
-$rn1 = $matches[1]; /* resource number */
+$rn1 = (int)$c1;
oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2");
// Second connect should return a new resource because the hash string will be different from $c1
$c2 = oci_pconnect("testuser", "testuserpwd2", $dbase);
var_dump($c2);
-
-ob_start();
-var_dump($c2);
-$r2 = ob_get_clean();
-preg_match("/resource\(([0-9])\) of.*/", $r2, $matches);
-$rn2 = $matches[1]; /* resource number */
+$rn2 = (int)$c2;
// Despite using the old password this connect should succeed and return the original resource
$c3 = oci_pconnect("testuser", "testuserpwd", $dbase);
var_dump($c3);
-
-ob_start();
-var_dump($c3);
-$r3 = ob_get_clean();
-preg_match("/resource\(([0-9])\) of.*/", $r3, $matches);
-$rn3 = $matches[1]; /* resource number */
+$rn3 = (int)$c3;
// Connections should differ
if ($rn1 == $rn2) {
@@ -76,10 +62,12 @@ else {
}
// Clean up
-// Can't drop a user that is connected and can't close a persistent
-// connection. So this test will leave the dummy user around, but the
-// schema will not be usable..
-$s = oci_parse($c0, "revoke connect, create session from testuser");
+oci_close($c1);
+oci_close($c2);
+oci_close($c3);
+
+// Clean up
+$s = oci_parse($c0, "drop user cascade testuser");
@oci_execute($s);
echo "Done\n";
diff --git a/ext/oci8/tests/password_new.phpt b/ext/oci8/tests/password_new.phpt
index a31843cfd..49c21dd34 100644
--- a/ext/oci8/tests/password_new.phpt
+++ b/ext/oci8/tests/password_new.phpt
@@ -1,7 +1,25 @@
--TEST--
oci_password_change()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+require dirname(__FILE__)."/connect.inc";
+if (empty($dbase)) die ("skip requires database connection string be set");
+
+// This test is known to fail with Oracle 10g client libraries
+// connecting to Oracle Database 11.1.0.6 (Oracle bug 6277160)
+$sv = oci_server_version($c);
+$sv = preg_match('/11.1/', $sv, $matches);
+if ($sv === 1) {
+ ob_start();
+ phpinfo(INFO_MODULES);
+ $phpinfo = ob_get_clean();
+ $iv = preg_match('/Oracle .*Version => 10/', $phpinfo);
+ if ($iv === 1) {
+ die ("skip test known to fail using Oracle 10gR2 client libs connecting to Oracle 11.1 (6277160)");
+ }
+}
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/password_old.phpt b/ext/oci8/tests/password_old.phpt
index d293fce87..8ed1d3d43 100644
--- a/ext/oci8/tests/password_old.phpt
+++ b/ext/oci8/tests/password_old.phpt
@@ -1,14 +1,32 @@
--TEST--
ocipasswordchange()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+require dirname(__FILE__)."/connect.inc";
+if (empty($dbase)) die ("skip requires database connection string be set");
+
+// This test is known to fail with Oracle 10g client libraries
+// connecting to Oracle Database 11.1.0.6 (Oracle bug 6277160)
+$sv = oci_server_version($c);
+$sv = preg_match('/11.1/', $sv, $matches);
+if ($sv === 1) {
+ ob_start();
+ phpinfo(INFO_MODULES);
+ $phpinfo = ob_get_clean();
+ $iv = preg_match('/Oracle .*Version => 10/', $phpinfo);
+ if ($iv === 1) {
+ die ("skip test known to fail using Oracle 10gR2 client libs connecting to Oracle 11.1 (6277160)");
+ }
+}
+?>
--FILE--
<?php
require dirname(__FILE__)."/connect.inc";
$new_password = "test";
-var_dump(ocipasswordchange($c, $user, $password, $new_password));
+var_dump(ocipasswordchange($dbase, $user, $password, $new_password));
if (!empty($dbase)) {
var_dump($new_c = ocilogon($user,$new_password,$dbase));
@@ -17,14 +35,14 @@ else {
var_dump($new_c = ocilogon($user,$new_password));
}
-var_dump(ocipasswordchange($new_c, $user, $new_password, $password));
+var_dump(ocipasswordchange($dbase, $user, $new_password, $password));
echo "Done\n";
?>
--EXPECTF--
-bool(true)
resource(%d) of type (oci8 connection)
-bool(true)
+resource(%d) of type (oci8 connection)
+resource(%d) of type (oci8 connection)
Done
diff --git a/ext/oci8/tests/pecl_bug10194_blob.phpt b/ext/oci8/tests/pecl_bug10194_blob.phpt
index 1a44e4494..4c6aa4f1c 100644
--- a/ext/oci8/tests/pecl_bug10194_blob.phpt
+++ b/ext/oci8/tests/pecl_bug10194_blob.phpt
@@ -1,19 +1,22 @@
--TEST--
PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
+?>
--INI--
-memory_limit=10M
+memory_limit=3M
--FILE--
<?php
+
+// This test is dependent on the behavior of the memory manager
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
-$ora_sql = "INSERT INTO
- ".$schema.$table_name." (blob)
- VALUES (empty_blob())
- ";
+$ora_sql = "INSERT INTO ".$schema.$table_name." (blob)
+ VALUES (empty_blob())";
$statement = oci_parse($c,$ora_sql);
oci_execute($statement);
@@ -32,10 +35,12 @@ for ($i = 0; $i < 8; $i++) {
oci_commit($c);
-$ora_sql = "SELECT blob FROM ".$schema.$table_name."";
+$ora_sql = "SELECT blob FROM ".$schema.$table_name;
$statement = oci_parse($c,$ora_sql);
oci_execute($statement);
+echo "Before load()\n";
+
$row = oci_fetch_assoc($statement);
var_dump(strlen($row['BLOB']->load())); /* here it should fail */
@@ -44,4 +49,6 @@ require dirname(__FILE__).'/drop_table.inc';
echo "Done\n";
?>
--EXPECTF--
+Before load()
+
Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
diff --git a/ext/oci8/tests/pecl_bug10194_blob_64.phpt b/ext/oci8/tests/pecl_bug10194_blob_64.phpt
new file mode 100644
index 000000000..433d586a4
--- /dev/null
+++ b/ext/oci8/tests/pecl_bug10194_blob_64.phpt
@@ -0,0 +1,54 @@
+--TEST--
+PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback)
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only");
+?>
+--INI--
+memory_limit=6M
+--FILE--
+<?php
+
+// This test is dependent on the behavior of the memory manager
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO ".$schema.$table_name." (blob)
+ VALUES (empty_blob())";
+
+$statement = oci_parse($c,$ora_sql);
+oci_execute($statement);
+
+$ora_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
+$statement = oci_parse($c,$ora_sql);
+oci_execute($statement, OCI_DEFAULT);
+
+$row = oci_fetch_assoc($statement);
+
+$string = str_repeat("test", 32768*4*4);
+
+for ($i = 0; $i < 8; $i++) {
+ $row['BLOB']->write($string);
+}
+
+oci_commit($c);
+
+$ora_sql = "SELECT blob FROM ".$schema.$table_name;
+$statement = oci_parse($c,$ora_sql);
+oci_execute($statement);
+
+echo "Before load()\n";
+
+$row = oci_fetch_assoc($statement);
+var_dump(strlen($row['BLOB']->load())); /* here it should fail */
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECTF--
+Before load()
+
+Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
diff --git a/ext/oci8/tests/testping.phpt b/ext/oci8/tests/testping.phpt
new file mode 100644
index 000000000..a0d65a30c
--- /dev/null
+++ b/ext/oci8/tests/testping.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Exercise OCIPing functionality on reconnect (code coverage test)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--INI--
+oci8.ping_interval=0
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/details.inc');
+
+for ($i = 0; $i < 2; $i++) {
+ if (!empty($dbase)) {
+ $c = oci_pconnect($user,$password,$dbase);
+ }
+ else {
+ $c = oci_pconnect($user,$password);
+ }
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Done