summaryrefslogtreecommitdiff
path: root/ext/oci8
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:39:08 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:39:08 -0400
commit993e1866df547532a05ab6db76c9ff5aefc9a3df (patch)
tree169d3bde0974235d3cde164786ef6f381a4749a7 /ext/oci8
parent1f589a2bd44ba835ad1b009a5d83abd453724829 (diff)
downloadphp-upstream/5.2.6.tar.gz
Imported Upstream version 5.2.6upstream/5.2.6
Diffstat (limited to 'ext/oci8')
-rw-r--r--ext/oci8/config.m419
-rw-r--r--ext/oci8/oci8.c17
-rw-r--r--ext/oci8/oci8_collection.c14
-rw-r--r--ext/oci8/oci8_interface.c11
-rw-r--r--ext/oci8/oci8_lob.c34
-rw-r--r--ext/oci8/oci8_statement.c22
-rw-r--r--ext/oci8/php_oci8.h4
-rw-r--r--ext/oci8/php_oci8_int.h8
-rw-r--r--ext/oci8/tests/bug27303.phpt382
-rw-r--r--ext/oci8/tests/bug27303_2.phpt202
-rw-r--r--ext/oci8/tests/bug27303_4.phpt382
-rw-r--r--ext/oci8/tests/bug42496_1.phpt61
-rw-r--r--ext/oci8/tests/bug42496_2.phpt59
-rw-r--r--ext/oci8/tests/bug42841.phpt187
-rw-r--r--ext/oci8/tests/bug43492.phpt378
-rw-r--r--ext/oci8/tests/bug43492_2.phpt369
-rw-r--r--ext/oci8/tests/bug43497.phpt294
-rw-r--r--ext/oci8/tests/bug44008.phpt54
-rw-r--r--ext/oci8/tests/bug44113.phpt53
-rw-r--r--ext/oci8/tests/bug44206.phpt41
-rw-r--r--ext/oci8/tests/bug6109.phpt46
-rw-r--r--ext/oci8/tests/lob_014.phpt4
-rw-r--r--ext/oci8/tests/lob_021.phpt6
-rw-r--r--ext/oci8/tests/lob_039.phpt4
-rw-r--r--ext/oci8/tests/lob_041.phpt92
-rw-r--r--ext/oci8/tests/lob_042.phpt71
26 files changed, 2283 insertions, 531 deletions
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4
index fda720148..37c99e880 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.11 2007/08/14 12:15:04 tony2001 Exp $
+dnl $Id: config.m4,v 1.55.2.3.2.12 2008/01/16 00:42:02 sixd Exp $
dnl
if test -z "$SED"; then
@@ -143,7 +143,9 @@ fi
PHP_OCI8_INSTANT_CLIENT="no"
-if test "`echo $PHP_OCI8 | cut -d, -f2`" = "instantclient"; then
+if test "`echo $PHP_OCI8`" = "instantclient"; then
+ PHP_OCI8_INSTANT_CLIENT="yes"
+elif test "`echo $PHP_OCI8 | cut -d, -f2`" = "instantclient"; then
PHP_OCI8_INSTANT_CLIENT="`echo $PHP_OCI8 | cut -d, -f3`"
PHP_OCI8="`echo $PHP_OCI8 | cut -d, -f1,4`"
if test "$PHP_OCI8_INSTANT_CLIENT" = ""; then
@@ -345,14 +347,21 @@ if test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
elif test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" != "no"; then
+ AC_CHECK_SIZEOF(long int, 4)
+ LIBDIR_SUFFIX=""
+ if test "$ac_cv_sizeof_long_int" = "8" ; then
+ LIBDIR_SUFFIX=64
+ fi
+
AC_MSG_CHECKING([Oracle Instant Client directory])
if test "$PHP_OCI8_INSTANT_CLIENT" = "yes"; then
+dnl Find the directory if user specified "instantclient" but did not give a dir.
dnl Generally the Instant Client can be anywhere so the user must pass in the
dnl directory to the libraries. But on Linux we default to the most recent
dnl version in /usr/lib
- PHP_OCI8_INSTANT_CLIENT=`ls -d /usr/lib/oracle/*/client/lib 2> /dev/null | tail -1`
+ PHP_OCI8_INSTANT_CLIENT=`ls -d /usr/lib/oracle/*/client${LIBDIR_SUFFIX}/lib 2> /dev/null | tail -1`
if test -z "$PHP_OCI8_INSTANT_CLIENT"; then
- AC_MSG_ERROR([Oracle Instant Client directory not found. Try --with-oci8=instantclient,DIR])
+ AC_MSG_ERROR([Oracle Instant Client directory /usr/lib/oracle/.../client${LIBDIR_SUFFIX}/lib not found. Try --with-oci8=instantclient,DIR])
fi
fi
AC_MSG_RESULT($PHP_OCI8_INSTANT_CLIENT)
@@ -362,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!'`
+ OCISDKRPMINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!^/usr/lib/oracle/\(.*\)/client\(.*\)/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 08a0629bf..8f8a2b8cd 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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.38 2007/08/31 22:30:27 tony2001 Exp $ */
+/* $Id: oci8.c,v 1.269.2.16.2.43 2008/04/10 21:53:46 sixd Exp $ */
/* TODO
*
* file://localhost/www/docs/oci10/ociaahan.htm#423823 - implement lob_empty() with OCI_ATTR_LOBEMPTY
@@ -377,7 +377,7 @@ zend_module_entry oci8_module_entry = {
PHP_RINIT(oci), /* per-request startup function */
PHP_RSHUTDOWN(oci), /* per-request shutdown function */
PHP_MINFO(oci), /* information function */
- "1.2.4",
+ "1.2.5",
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
PHP_MODULE_GLOBALS(oci), /* globals descriptor */
PHP_GINIT(oci), /* globals ctor */
@@ -673,8 +673,8 @@ 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.4");
- php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.38 $");
+ php_info_print_table_row(2, "Version", "1.2.5");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.43 $");
snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent));
php_info_print_table_row(2, "Active Persistent Connections", buf);
@@ -1604,6 +1604,7 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR
ub4 lob_length;
int column_size;
char *lob_buffer;
+ int lob_fetch_status;
if (column->indicator == -1) { /* column is NULL */
ZVAL_NULL(value);
@@ -1634,7 +1635,11 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR
if (column->data_type != SQLT_RDD && (mode & PHP_OCI_RETURN_LOBS)) {
/* PHP_OCI_RETURN_LOBS means that we want the content of the LOB back instead of the locator */
- if (php_oci_lob_read(descriptor, -1, 0, &lob_buffer, &lob_length TSRMLS_CC)) {
+ lob_fetch_status = php_oci_lob_read(descriptor, -1, 0, &lob_buffer, &lob_length TSRMLS_CC);
+#ifdef HAVE_OCI8_TEMP_LOB
+ php_oci_temp_lob_close(descriptor TSRMLS_CC);
+#endif
+ if (lob_fetch_status) {
ZVAL_FALSE(value);
return 1;
} else {
diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c
index 3e7b30b56..73879a674 100644
--- a/ext/oci8/oci8_collection.c
+++ b/ext/oci8/oci8_collection.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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.7 2007/07/31 19:21:08 tony2001 Exp $ */
+/* $Id: oci8_collection.c,v 1.5.2.3.2.9 2008/02/15 23:05:19 sixd Exp $ */
@@ -44,9 +44,9 @@
/* {{{ php_oci_collection_create()
Create and return connection handle */
-php_oci_collection * php_oci_collection_create(php_oci_connection* connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC)
+php_oci_collection * php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC)
{
- dvoid *dschp1;
+ dvoid *dschp1 = NULL;
dvoid *parmp1;
dvoid *parmp2;
php_oci_collection *collection;
@@ -219,11 +219,17 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
goto CLEANUP;
}
+ /* free the describe handle (Bug #44113) */
+ PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE));
PHP_OCI_REGISTER_RESOURCE(collection, le_collection);
return collection;
CLEANUP:
+ if (dschp1) {
+ /* free the describe handle (Bug #44113) */
+ PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE));
+ }
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
php_oci_collection_close(collection TSRMLS_CC);
return NULL;
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index c6a78a24f..071bfaba4 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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.13 2007/08/02 19:04:37 sixd Exp $ */
+/* $Id: oci8_interface.c,v 1.8.2.7.2.16 2008/04/02 14:56:43 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1509,11 +1509,8 @@ PHP_FUNCTION(oci_free_statement)
}
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
- if (!statement->nested) {
- /* nested cursors cannot be freed, they are allocated once and used during the fetch */
- zend_list_delete(statement->id);
- }
-
+
+ zend_list_delete(statement->id);
RETURN_TRUE;
}
/* }}} */
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index 066ff0a3b..1bccf3188 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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.14 2007/07/31 19:21:08 tony2001 Exp $ */
+/* $Id: oci8_lob.c,v 1.7.2.6.2.18 2008/02/25 23:52:10 sixd Exp $ */
@@ -88,6 +88,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ
descriptor->buffering = PHP_OCI_LOB_BUFFER_DISABLED; /* buffering is off by default */
descriptor->charset_form = SQLCS_IMPLICIT; /* default value */
descriptor->charset_id = connection->charset;
+ descriptor->is_open = 0;
if (descriptor->type == OCI_DTYPE_LOB || descriptor->type == OCI_DTYPE_FILE) {
/* add Lobs & Files to hash. we'll flush them at the end */
@@ -570,16 +571,31 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d
int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
- int is_temporary;
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobClose, (connection->svc, connection->err, descriptor->descriptor));
+ if (descriptor->is_open) {
+ PHP_OCI_CALL_RETURN(connection->errcode, OCILobClose, (connection->svc, connection->err, descriptor->descriptor));
+ }
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+
+ if (php_oci_temp_lob_close(descriptor TSRMLS_CC)) {
+ return 1;
+ }
+ return 0;
+} /* }}} */
+
+/* {{{ php_oci_temp_lob_close()
+ Close Temporary LOB */
+int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
+{
+ php_oci_connection *connection = descriptor->connection;
+ int is_temporary;
+
PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary));
if (connection->errcode != OCI_SUCCESS) {
@@ -589,7 +605,6 @@ int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
}
if (is_temporary) {
-
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor));
if (connection->errcode != OCI_SUCCESS) {
@@ -647,7 +662,6 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC)
Close LOB descriptor and free associated resources */
void php_oci_lob_free (php_oci_descriptor *descriptor TSRMLS_DC)
{
-
if (!descriptor || !descriptor->connection) {
return;
}
@@ -662,6 +676,12 @@ void php_oci_lob_free (php_oci_descriptor *descriptor TSRMLS_DC)
php_oci_lob_flush(descriptor, OCI_LOB_BUFFER_FREE TSRMLS_CC);
}
+#ifdef HAVE_OCI8_TEMP_LOB
+ if (descriptor->type == OCI_DTYPE_LOB) {
+ php_oci_temp_lob_close(descriptor TSRMLS_CC);
+ }
+#endif
+
PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type));
zend_list_delete(descriptor->connection->rsrc_id);
@@ -891,6 +911,8 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data,
return 1;
}
+ descriptor->is_open = 1;
+
return php_oci_lob_write(descriptor, 0, data, data_len, &bytes_written TSRMLS_CC);
} /* }}} */
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index 52e0c3546..603dbe5d9 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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.28 2007/08/02 19:04:37 sixd Exp $ */
+/* $Id: oci8_statement.c,v 1.7.2.14.2.33 2008/04/02 14:56:43 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
@@ -106,7 +106,7 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha
statement->connection = connection;
statement->has_data = 0;
- statement->nested = 0;
+ statement->parent_stmtid = 0;
zend_list_addref(statement->connection->rsrc_id);
if (OCI_G(default_prefetch) > 0) {
@@ -336,6 +336,7 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
if (!nested_stmt) {
return OCI_ERROR;
}
+ nested_stmt->parent_stmtid = outcol->statement->id;
zend_list_addref(outcol->statement->id);
outcol->nested_statement = nested_stmt;
outcol->stmtid = nested_stmt->id;
@@ -368,7 +369,6 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
if (!descr) {
return OCI_ERROR;
}
- zend_list_addref(outcol->statement->id);
outcol->descid = descr->id;
descr->charset_form = outcol->charset_form;
@@ -776,7 +776,11 @@ void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC)
zend_hash_destroy(statement->defines);
efree(statement->defines);
}
-
+
+ if (statement->parent_stmtid) {
+ zend_list_delete(statement->parent_stmtid);
+ }
+
zend_list_delete(statement->connection->rsrc_id);
efree(statement);
@@ -1175,6 +1179,14 @@ sb4 php_oci_bind_out_callback(
}
if (Z_TYPE_P(val) == IS_RESOURCE) {
+ /* Processing for ref-cursor out binds */
+ if (phpbind->statement != NULL) {
+ *bufpp = phpbind->statement;
+ *alenpp = &phpbind->dummy_len;
+ *piecep = OCI_ONE_PIECE;
+ *rcodepp = &phpbind->retcode;
+ *indpp = &phpbind->indicator;
+ }
retval = OCI_CONTINUE;
} else if (Z_TYPE_P(val) == IS_OBJECT) {
if (!phpbind->descriptor) {
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index 08bd51fba..f4f332af7 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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.1 2007/01/01 09:36:03 sebastian Exp $ */
+/* $Id: php_oci8.h,v 1.36.2.2.2.2 2007/12/31 07:20:09 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 e849a40c3..6e9ed5e93 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-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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.21 2007/08/06 20:32:55 sixd Exp $ */
+/* $Id: php_oci8_int.h,v 1.11.2.6.2.24 2008/02/25 23:52:10 sixd Exp $ */
#if HAVE_OCI8
# ifndef PHP_OCI8_INT_H
@@ -130,6 +130,7 @@ typedef struct { /* php_oci_descriptor {{{ */
ub4 chunk_size; /* chunk size of the LOB. 0 - unknown */
ub1 charset_form; /* charset form, required for NCLOBs */
ub2 charset_id; /* charset ID */
+ unsigned is_open:1; /* helps to determine if LOB is open or not */
} php_oci_descriptor; /* }}} */
typedef struct { /* php_oci_lob_ctx {{{ */
@@ -158,6 +159,7 @@ typedef struct { /* php_oci_define {{{ */
typedef struct { /* php_oci_statement {{{ */
int id;
+ int parent_stmtid; /* parent statement id */
php_oci_connection *connection; /* parent connection handle */
sword errcode; /* last errcode*/
OCIError *err; /* private error handle */
@@ -170,7 +172,6 @@ typedef struct { /* php_oci_statement {{{ */
int ncolumns; /* number of columns in the result */
unsigned executed:1; /* statement executed flag */
unsigned has_data:1; /* statement has more data flag */
- unsigned nested:1; /* statement handle is valid */
ub2 stmttype; /* statement type */
} php_oci_statement; /* }}} */
@@ -342,6 +343,7 @@ int php_oci_lob_get_buffering (php_oci_descriptor *);
int php_oci_lob_copy (php_oci_descriptor *, php_oci_descriptor *, long TSRMLS_DC);
#ifdef HAVE_OCI8_TEMP_LOB
int php_oci_lob_close (php_oci_descriptor * TSRMLS_DC);
+int php_oci_temp_lob_close (php_oci_descriptor * TSRMLS_DC);
int php_oci_lob_write_tmp (php_oci_descriptor *, ub1, char *, int TSRMLS_DC);
#endif
void php_oci_lob_free(php_oci_descriptor * TSRMLS_DC);
diff --git a/ext/oci8/tests/bug27303.phpt b/ext/oci8/tests/bug27303.phpt
index 467dbfe63..6f6d01af4 100644
--- a/ext/oci8/tests/bug27303.phpt
+++ b/ext/oci8/tests/bug27303.phpt
@@ -49,7 +49,7 @@ foreach ($create_st as $statement) {
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(1) "1"
string(1) "2"
string(1) "3"
@@ -59,194 +59,194 @@ 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"
+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
diff --git a/ext/oci8/tests/bug27303_2.phpt b/ext/oci8/tests/bug27303_2.phpt
index 97acefa30..3ab90a1a6 100644
--- a/ext/oci8/tests/bug27303_2.phpt
+++ b/ext/oci8/tests/bug27303_2.phpt
@@ -49,7 +49,7 @@ foreach ($create_st as $statement) {
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(1) "1"
string(1) "2"
string(1) "3"
@@ -149,104 +149,104 @@ 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"
+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
diff --git a/ext/oci8/tests/bug27303_4.phpt b/ext/oci8/tests/bug27303_4.phpt
index ed178f1a7..70d6b5688 100644
--- a/ext/oci8/tests/bug27303_4.phpt
+++ b/ext/oci8/tests/bug27303_4.phpt
@@ -49,7 +49,7 @@ foreach ($create_st as $statement) {
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(1) "1"
string(1) "2"
string(1) "3"
@@ -59,194 +59,194 @@ 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"
+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
diff --git a/ext/oci8/tests/bug42496_1.phpt b/ext/oci8/tests/bug42496_1.phpt
new file mode 100644
index 000000000..4d7e2c585
--- /dev/null
+++ b/ext/oci8/tests/bug42496_1.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+// Initialization
+
+$stmtarray = array(
+ "DROP table bug42496_tab",
+ "CREATE table bug42496_tab(c1 CLOB, c2 CLOB)",
+ "INSERT INTO bug42496_tab VALUES('test1', 'test1')",
+ "INSERT INTO bug42496_tab VALUES('test2', 'test2')",
+ "INSERT INTO bug42496_tab VALUES('test3', 'test3')"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+// Run Test
+
+echo "Test 1\n";
+
+for ($i = 0; $i < 15000; $i++) {
+ $s = oci_parse($c, "SELECT * from bug42496_tab");
+ oci_define_by_name($s, "C1", $col1);
+ oci_define_by_name($s, "C2", $col2);
+ if (oci_execute($s)) {
+ $arr = array();
+ while ($arr = oci_fetch_assoc($s)) {
+ $arr['C1']->free();
+ $arr['C2']->free();
+ }
+ }
+ oci_free_statement($s);
+}
+
+echo "Done\n";
+
+// Cleanup
+
+$stmtarray = array(
+ "DROP table bug42496_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+oci_close($c);
+
+?>
+--EXPECTF--
+Test 1
+Done
diff --git a/ext/oci8/tests/bug42496_2.phpt b/ext/oci8/tests/bug42496_2.phpt
new file mode 100644
index 000000000..e2800bbd8
--- /dev/null
+++ b/ext/oci8/tests/bug42496_2.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+// Initialization
+
+$stmtarray = array(
+ "DROP table bug42496_tab",
+ "CREATE table bug42496_tab(c1 CLOB, c2 CLOB)",
+ "INSERT INTO bug42496_tab VALUES('test1', 'test1')",
+ "INSERT INTO bug42496_tab VALUES('test2', 'test2')",
+ "INSERT INTO bug42496_tab VALUES('test3', 'test3')"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+// Run Test
+
+echo "Test 2\n";
+
+for ($i = 0; $i < 15000; $i++) {
+ $s = oci_parse($c, "SELECT * from bug42496_tab");
+ if (oci_execute($s)) {
+ $arr = array();
+ while ($arr = oci_fetch_assoc($s)) {
+ $arr['C1']->free();
+ $arr['C2']->free();
+ }
+ }
+ oci_free_statement($s);
+}
+
+echo "Done\n";
+
+// Cleanup
+
+$stmtarray = array(
+ "DROP table bug42496_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+oci_close($c);
+
+?>
+--EXPECTF--
+Test 2
+Done
diff --git a/ext/oci8/tests/bug42841.phpt b/ext/oci8/tests/bug42841.phpt
new file mode 100644
index 000000000..921c8149d
--- /dev/null
+++ b/ext/oci8/tests/bug42841.phpt
@@ -0,0 +1,187 @@
+--TEST--
+Bug #42841 (REF CURSOR and oci_new_cursor PHP crash)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.statement_cache_size=20
+--FILE--
+<?php
+
+require dirname(__FILE__).'/details.inc';
+
+// note a oci_new_connect() occurs lower in the script
+$c = oci_connect($user, $password, $dbase);
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure bug42841_proc(out_1 out sys_refcursor) is
+ begin
+ open out_1 for select 11 from dual union all select 12 from dual union all select 13 from dual;
+ end bug42841_proc;",
+
+ "create or replace package bug43449_pkg is
+ type cursortype is ref Cursor;
+ function testcursor return cursortype;
+ end bug43449_pkg;",
+
+ "create or replace package body bug43449_pkg is
+ function testcursor return cursortype is
+ retCursor cursorType;
+ begin
+ Open retCursor For 'select * from dual';
+ return retCursor;
+ end;
+ end bug43449_pkg;"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+// Main code
+
+function do_bug42841($c)
+{
+ echo "First attempt\n";
+
+ $sql = "BEGIN bug42841_proc(:cursor); END;";
+ $stmt = oci_parse($c, $sql);
+ $cursor = oci_new_cursor($c);
+ oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
+
+ oci_execute($stmt, OCI_DEFAULT);
+ oci_execute($cursor);
+
+ while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
+ $data1[] = $row;
+ }
+
+ oci_free_statement($stmt);
+ oci_free_statement($cursor);
+ var_dump($data1);
+
+ echo "Second attempt\n";
+
+ $sql = "BEGIN bug42841_proc(:cursor); END;";
+ $stmt = oci_parse($c, $sql);
+ $cursor = oci_new_cursor($c);
+ oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
+
+ oci_execute($stmt, OCI_DEFAULT);
+ oci_execute($cursor);
+
+ while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
+ $data2[] = $row;
+ }
+
+ oci_free_statement($stmt);
+ oci_free_statement($cursor);
+ var_dump($data2);
+}
+
+function do_bug43449($c)
+{
+
+ for ($i = 0; $i < 2; $i++) {
+ var_dump(bug43449_getCur($c));
+ }
+}
+
+function bug43449_getCur($c)
+{
+ $cur = oci_new_cursor($c);
+ $stmt = oci_parse($c, 'begin :cur := bug43449_pkg.testcursor; end;');
+ oci_bind_by_name($stmt, ':cur', $cur, -1, OCI_B_CURSOR);
+ oci_execute($stmt, OCI_DEFAULT);
+ oci_execute($cur, OCI_DEFAULT);
+
+ $ret = array();
+
+ while (ocifetchinto($cur, $row, OCI_ASSOC)) {
+ $ret[] = $row;
+ }
+
+ oci_free_statement($cur);
+ oci_free_statement($stmt);
+ return $ret;
+}
+
+echo "Test bug 42841: Procedure with OUT cursor parameter\n";
+do_bug42841($c);
+
+$c = oci_new_connect($user, $password, $dbase);
+
+echo "Test bug 43449: Cursor as function result\n";
+do_bug43449($c);
+
+// Cleanup
+
+$stmtarray = array(
+ "drop procedure bug42841_proc",
+ "drop package bug43449_pkg"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Test bug 42841: Procedure with OUT cursor parameter
+First attempt
+array(3) {
+ [0]=>
+ array(1) {
+ [11]=>
+ string(2) "11"
+ }
+ [1]=>
+ array(1) {
+ [11]=>
+ string(2) "12"
+ }
+ [2]=>
+ array(1) {
+ [11]=>
+ string(2) "13"
+ }
+}
+Second attempt
+array(3) {
+ [0]=>
+ array(1) {
+ [11]=>
+ string(2) "11"
+ }
+ [1]=>
+ array(1) {
+ [11]=>
+ string(2) "12"
+ }
+ [2]=>
+ array(1) {
+ [11]=>
+ string(2) "13"
+ }
+}
+Test bug 43449: Cursor as function result
+array(1) {
+ [0]=>
+ array(1) {
+ ["DUMMY"]=>
+ string(1) "X"
+ }
+}
+array(1) {
+ [0]=>
+ array(1) {
+ ["DUMMY"]=>
+ string(1) "X"
+ }
+}
+Done
diff --git a/ext/oci8/tests/bug43492.phpt b/ext/oci8/tests/bug43492.phpt
new file mode 100644
index 000000000..d28aabfce
--- /dev/null
+++ b/ext/oci8/tests/bug43492.phpt
@@ -0,0 +1,378 @@
+--TEST--
+Bug #43492 (Nested cursor leaks)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$stmtarray = array(
+ "DROP table bug43492_tab",
+ "CREATE TABLE bug43492_tab(col1 VARCHAR2(1))",
+ "INSERT INTO bug43492_tab VALUES ('A')",
+ "INSERT INTO bug43492_tab VALUES ('B')",
+ "INSERT INTO bug43492_tab VALUES ('C')",
+ "INSERT INTO bug43492_tab VALUES ('D')",
+ "INSERT INTO bug43492_tab VALUES ('E')",
+ "INSERT INTO bug43492_tab VALUES ('F')",
+ "INSERT INTO bug43492_tab VALUES ('G')",
+ "INSERT INTO bug43492_tab VALUES ('H')",
+ "INSERT INTO bug43492_tab VALUES ('I')",
+ "INSERT INTO bug43492_tab VALUES ('J')"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+/*
+
+While fetching data from a ref cursor, the parent statement needs to
+be around. Also when the parent statement goes out of scope, it is
+not automatically released which causes a cursor leak.
+
+If either or both of the lines marked (*) are removed, then the script
+will fail with the error "ORA-01000: maximum open cursors exceeded".
+
+*/
+
+function fetch($c, $i) {
+ global $s; // (*) Allow parent statement to be available when child is used
+ $s = ociparse($c, 'select cursor(select * from bug43492_tab) c from bug43492_tab');
+ ociexecute($s, OCI_DEFAULT);
+ ocifetchinto($s, $result, OCI_ASSOC);
+ ociexecute($result['C'], OCI_DEFAULT);
+ return $result['C'];
+}
+
+for($i = 0; $i < 300; $i++) {
+ $cur = fetch($c, $i);
+ for($j = 0; $j < 10; $j++) {
+ ocifetchinto($cur, $row, OCI_NUM);
+ echo "$row[0] ";
+ }
+ echo "\n";
+ ocifreestatement($cur);
+ ocifreestatement($s); // (*) Free the parent statement cleanly
+}
+
+echo "Done\n";
+
+// Cleanup
+
+$stmtarray = array(
+ "DROP table bug43492_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+oci_close($c);
+
+?>
+--EXPECT--
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+Done
diff --git a/ext/oci8/tests/bug43492_2.phpt b/ext/oci8/tests/bug43492_2.phpt
new file mode 100644
index 000000000..fcf96e984
--- /dev/null
+++ b/ext/oci8/tests/bug43492_2.phpt
@@ -0,0 +1,369 @@
+--TEST--
+Bug #43492 (Nested cursor leaks after related bug #44206 fixed)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+// This test is similar to bug43492.phpt without the explict free.
+// Now that bug 44206 is fixed an automatic clean up will occur -
+// though it is still recommended in practice.
+
+require dirname(__FILE__).'/connect.inc';
+
+$stmtarray = array(
+ "DROP table bug43492_tab",
+ "CREATE TABLE bug43492_tab(col1 VARCHAR2(1))",
+ "INSERT INTO bug43492_tab VALUES ('A')",
+ "INSERT INTO bug43492_tab VALUES ('B')",
+ "INSERT INTO bug43492_tab VALUES ('C')",
+ "INSERT INTO bug43492_tab VALUES ('D')",
+ "INSERT INTO bug43492_tab VALUES ('E')",
+ "INSERT INTO bug43492_tab VALUES ('F')",
+ "INSERT INTO bug43492_tab VALUES ('G')",
+ "INSERT INTO bug43492_tab VALUES ('H')",
+ "INSERT INTO bug43492_tab VALUES ('I')",
+ "INSERT INTO bug43492_tab VALUES ('J')"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+function fetch($c, $i) {
+ $s = ociparse($c, 'select cursor(select * from bug43492_tab) c from bug43492_tab');
+ ociexecute($s, OCI_DEFAULT);
+ ocifetchinto($s, $result, OCI_ASSOC);
+ ociexecute($result['C'], OCI_DEFAULT);
+ return $result['C'];
+}
+
+for($i = 0; $i < 300; $i++) {
+ $cur = fetch($c, $i);
+ for($j = 0; $j < 10; $j++) {
+ ocifetchinto($cur, $row, OCI_NUM);
+ echo "$row[0] ";
+ }
+ echo "\n";
+ ocifreestatement($cur);
+}
+
+echo "Done\n";
+
+// Cleanup
+
+$stmtarray = array(
+ "DROP table bug43492_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+oci_close($c);
+
+?>
+--EXPECT--
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+Done
diff --git a/ext/oci8/tests/bug43497.phpt b/ext/oci8/tests/bug43497.phpt
new file mode 100644
index 000000000..908fe5897
--- /dev/null
+++ b/ext/oci8/tests/bug43497.phpt
@@ -0,0 +1,294 @@
+--TEST--
+Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--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 = 0
+Loop count check = 100
+
+Run = 3
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 4
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 5
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 6
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 7
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 8
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 9
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 10
+Temporary LOBs = 0
+Loop count check = 100
+
+Implicit LOB use
+
+Run = 1
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 2
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 3
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 4
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 5
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 6
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 7
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 8
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 9
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 10
+Temporary LOBs = 0
+Loop count check = 100
+
+Explicit LOB with no free (i.e. a temp lob leak)
+
+Run = 1
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 2
+Temporary LOBs = 99
+Loop count check = 100
+
+Run = 3
+Temporary LOBs = 198
+Loop count check = 100
+
+Run = 4
+Temporary LOBs = 297
+Loop count check = 100
+
+Run = 5
+Temporary LOBs = 396
+Loop count check = 100
+
+Run = 6
+Temporary LOBs = 495
+Loop count check = 100
+
+Run = 7
+Temporary LOBs = 594
+Loop count check = 100
+
+Run = 8
+Temporary LOBs = 693
+Loop count check = 100
+
+Run = 9
+Temporary LOBs = 792
+Loop count check = 100
+
+Run = 10
+Temporary LOBs = 891
+Loop count check = 100
+Done
diff --git a/ext/oci8/tests/bug44008.phpt b/ext/oci8/tests/bug44008.phpt
new file mode 100644
index 000000000..fd10b26b8
--- /dev/null
+++ b/ext/oci8/tests/bug44008.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Bug #44008 (Incorrect usage of OCI-Lob->close doesn't crash PHP)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure bug44008_proc (p in out clob)
+ as begin p := 'A';
+ end;"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+// Run Test
+
+$s = oci_parse($c, 'begin bug44008_proc(:data); end;');
+$textLob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s, ":data", $textLob, -1, OCI_B_CLOB);
+oci_execute($s, OCI_DEFAULT);
+$r = $textLob->load();
+echo "$r\n";
+
+// Incorrectly closing the lob doesn't cause a crash.
+// OCI-LOB->close() is documented for use only with OCI-Lob->writeTemporary()
+$textLob->close();
+
+// Cleanup
+
+$stmtarray = array(
+ "drop procedure bug44008_proc"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
+
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECT--
+A
+Done
diff --git a/ext/oci8/tests/bug44113.phpt b/ext/oci8/tests/bug44113.phpt
new file mode 100644
index 000000000..646f09b7c
--- /dev/null
+++ b/ext/oci8/tests/bug44113.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Bug #44113 (New collection creation can fail with OCI-22303)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace type bug44113_list_t as table of number"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+// Run Test
+// 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++)
+{
+ if (!($var = oci_new_collection($c, 'BUG44113_LIST_T'))) {
+ print "Failed new collection creation on $x\n";
+ break;
+ }
+}
+
+print "Completed $x\n";
+
+// Cleanup
+
+$stmtarray = array(
+ "drop type bug44113_list_t"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
+
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Completed 70000
+Done
diff --git a/ext/oci8/tests/bug44206.phpt b/ext/oci8/tests/bug44206.phpt
new file mode 100644
index 000000000..ebf31f715
--- /dev/null
+++ b/ext/oci8/tests/bug44206.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Bug #44206 (Test if selecting ref cursors leads to ORA-1000 maximum open cursors reached)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Run Test
+
+for ($x = 0; $x < 400; $x++) {
+ $stmt = "select cursor (select $x from dual) a,
+ 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);
+ oci_execute($result['A']);
+ oci_execute($result['B']);
+ oci_fetch_array($result['A'], OCI_ASSOC);
+ oci_fetch_array($result['B'], OCI_ASSOC);
+ oci_free_statement($result['A']);
+ oci_free_statement($result['B']);
+ oci_free_statement($s);
+}
+
+echo "Completed $x\n";
+
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Completed 400
+Done
diff --git a/ext/oci8/tests/bug6109.phpt b/ext/oci8/tests/bug6109.phpt
new file mode 100644
index 000000000..029c5dddb
--- /dev/null
+++ b/ext/oci8/tests/bug6109.phpt
@@ -0,0 +1,46 @@
+--TEST--
+PECL Bug #6109 (Error messages not kept)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Run Test
+
+echo "Test 1\n";
+
+echo "Once Oracle has popped the message from its stack, the message is\n";
+echo "no longer available.\n";
+
+
+$s = oci_parse($c, 'delete from table_does_not_exist');
+$r = @oci_execute($s);
+
+if ($r) {
+ echo "whoops - table does exist\n";
+} else {
+ for ($i = 0; $i < 5; $i++) {
+ $err = oci_error($s);
+ echo ($i) .' -> '.$err['message'] ."\n";
+ }
+}
+
+// Cleanup
+
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1
+Once Oracle has popped the message from its stack, the message is
+no longer available.
+0 -> ORA-00942: %s
+1 ->
+2 ->
+3 ->
+4 ->
+Done
diff --git a/ext/oci8/tests/lob_014.phpt b/ext/oci8/tests/lob_014.phpt
index 60ed94531..1ba29ee64 100644
--- a/ext/oci8/tests/lob_014.phpt
+++ b/ext/oci8/tests/lob_014.phpt
@@ -43,9 +43,7 @@ echo "Done\n";
?>
--EXPECTF--
int(4)
-
-Warning: OCI-Lob::close(): ORA-22289: cannot perform operation on an unopened file or LOB in %slob_014.php on line %d
-bool(false)
+bool(true)
int(4)
bool(true)
diff --git a/ext/oci8/tests/lob_021.phpt b/ext/oci8/tests/lob_021.phpt
index 32ef6f9fe..0ae6b377a 100644
--- a/ext/oci8/tests/lob_021.phpt
+++ b/ext/oci8/tests/lob_021.phpt
@@ -20,8 +20,6 @@ $blob = oci_new_descriptor($c,OCI_D_LOB);
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
oci_execute($statement, OCI_DEFAULT);
-$blob;
-
var_dump($blob->write("test"));
var_dump($blob->close());
var_dump($blob->write("test"));
@@ -50,9 +48,7 @@ echo "Done\n";
?>
--EXPECTF--
int(4)
-
-Warning: OCI-Lob::close(): ORA-22289: cannot perform operation on an unopened file or LOB in %s on line %d
-bool(false)
+bool(true)
int(4)
bool(true)
diff --git a/ext/oci8/tests/lob_039.phpt b/ext/oci8/tests/lob_039.phpt
index 93251c8d8..5675f5a92 100644
--- a/ext/oci8/tests/lob_039.phpt
+++ b/ext/oci8/tests/lob_039.phpt
@@ -57,9 +57,9 @@ array(1) {
[0]=>
string(11) "clob test 1"
[1]=>
- string(11) "clob test 2"
+ string(22) " clob test 2"
[2]=>
- string(11) "clob test 3"
+ string(33) " clob test 3"
}
}
Done
diff --git a/ext/oci8/tests/lob_041.phpt b/ext/oci8/tests/lob_041.phpt
new file mode 100644
index 000000000..d04b43606
--- /dev/null
+++ b/ext/oci8/tests/lob_041.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Check LOBS are valid after statement free
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+// Initialization
+
+$stmtarray = array(
+ "DROP table lob_041_tab",
+ "CREATE table lob_041_tab(c1 CLOB)",
+ "INSERT INTO lob_041_tab VALUES('test data')"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+echo "Test 1 - explicit statement close\n";
+
+$s = oci_parse($c, "SELECT C1 FROM lob_041_tab");
+$desc = oci_new_descriptor($c, OCI_DTYPE_LOB);
+oci_define_by_name($s, "C1", $desc);
+oci_execute($s);
+$data = oci_fetch_assoc($s);
+oci_free_statement($s);
+echo $data['C1']->load(), "\n";
+oci_free_descriptor($desc);
+
+echo "\nTest 2 - implicit statement close\n";
+
+$s = oci_parse($c, "SELECT C1 FROM lob_041_tab");
+$desc = oci_new_descriptor($c, OCI_DTYPE_LOB);
+oci_define_by_name($s, "C1", $desc);
+oci_execute($s);
+$data = oci_fetch_assoc($s);
+$s = null;
+echo $data['C1']->load(), "\n";
+oci_free_descriptor($desc);
+var_dump($desc);
+
+echo "\nTest 3 - no preallocated descriptor\n";
+
+$s = oci_parse($c, "SELECT C1 FROM lob_041_tab");
+oci_execute($s);
+$data = oci_fetch_assoc($s);
+$s = null;
+echo $data['C1']->load(), "\n";
+var_dump($data);
+
+// Cleanup
+
+echo "Done\n";
+
+$stmtarray = array(
+ "DROP table lob_041_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+oci_close($c);
+
+?>
+
+--EXPECTF--
+Test 1 - explicit statement close
+test data
+
+Test 2 - implicit statement close
+test data
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+
+Test 3 - no preallocated descriptor
+test data
+array(1) {
+ ["C1"]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+Done
diff --git a/ext/oci8/tests/lob_042.phpt b/ext/oci8/tests/lob_042.phpt
new file mode 100644
index 000000000..d79b4846e
--- /dev/null
+++ b/ext/oci8/tests/lob_042.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Check various LOB error messages
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+// test some LOB error messages
+
+require(dirname(__FILE__).'/connect.inc');
+require(dirname(__FILE__).'/create_table.inc');
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob);
+
+var_dump($blob->writeTemporary("test", OCI_D_LOB));
+
+$str = "string";
+var_dump($blob->write($str));
+var_dump($blob->truncate(1));
+var_dump($blob->truncate(1));
+var_dump($blob->truncate(2));
+var_dump($blob->truncate(-1));
+var_dump($blob->read(2));
+
+var_dump($blob->import("does_not_exist"));
+var_dump($blob->saveFile("does_not_exist"));
+
+require(dirname(__FILE__).'/drop_table.inc');
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+
+Warning: OCI-Lob::writetemporary(): Invalid temporary lob type: %d in %s on line %d
+bool(false)
+int(6)
+bool(true)
+bool(true)
+
+Warning: OCI-Lob::truncate(): Size must be less than or equal to the current LOB size in %s on line %d
+bool(false)
+
+Warning: OCI-Lob::truncate(): Length must be greater than or equal to zero in %s on line %d
+bool(false)
+
+Warning: OCI-Lob::read(): Offset must be less than size of the LOB in %s on line %d
+bool(false)
+
+Warning: OCI-Lob::import(): Can't open file %s in %s on line %d
+bool(false)
+
+Warning: OCI-Lob::savefile(): Can't open file %s in %s on line %d
+bool(false)
+Done