summaryrefslogtreecommitdiff
path: root/ext/oci8
diff options
context:
space:
mode:
authorChristopher Jones <sixd@php.net>2008-04-18 00:04:45 +0000
committerChristopher Jones <sixd@php.net>2008-04-18 00:04:45 +0000
commit7f3604bbab88b5bf68504f248abf1cbfd63e57e3 (patch)
tree11ec30a44f7b291744334c24a9a9ca3930149f4a /ext/oci8
parent30800f4b12445210023d693a98367b9c21b9200c (diff)
downloadphp-git-7f3604bbab88b5bf68504f248abf1cbfd63e57e3.tar.gz
Code:
- Do scope-end release for oci_pconnect (oci8.old_oci_close_semantics=1 gives old behavior) - Fix session reuse with 10.2 client libs - Fix the Ping macro version check for 10.2 - Add type check associated with zend_list_find - Code connection re-organized for reuse - Format comments - WS changes - Prepare for new PECL release Tests: - Add new tests - Rationalize password tests - Revert use of __DIR__ so tests will work with PHP 5.2 - Update some skipifs to make tests more portable
Diffstat (limited to 'ext/oci8')
-rw-r--r--ext/oci8/CREDITS2
-rw-r--r--ext/oci8/README22
-rw-r--r--ext/oci8/oci8.c595
-rw-r--r--ext/oci8/oci8_collection.c138
-rw-r--r--ext/oci8/oci8_interface.c32
-rw-r--r--ext/oci8/oci8_lob.c112
-rw-r--r--ext/oci8/oci8_statement.c190
-rw-r--r--ext/oci8/php_oci8.h8
-rw-r--r--ext/oci8/php_oci8_int.h14
-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/drcp_cclass1.phpt4
-rw-r--r--ext/oci8/tests/drcp_connect1.phpt8
-rw-r--r--ext/oci8/tests/drcp_scope1.phpt1
-rw-r--r--ext/oci8/tests/drcp_scope2.phpt1
-rw-r--r--ext/oci8/tests/drcp_scope3.phpt61
-rw-r--r--ext/oci8/tests/drcp_scope4.phpt57
-rw-r--r--ext/oci8/tests/drcp_scope5.phpt63
-rw-r--r--ext/oci8/tests/password.phpt68
-rw-r--r--ext/oci8/tests/password_2.phpt32
-rw-r--r--ext/oci8/tests/password_new.phpt17
-rw-r--r--ext/oci8/tests/password_old.phpt25
-rw-r--r--ext/oci8/tests/pecl_bug10194_blob.phpt4
-rw-r--r--ext/oci8/tests/pecl_bug10194_blob_64.phpt2
-rw-r--r--ext/oci8/tests/testping.phpt2
26 files changed, 1198 insertions, 579 deletions
diff --git a/ext/oci8/CREDITS b/ext/oci8/CREDITS
index 18cad81c3e..4c1e0d05b7 100644
--- a/ext/oci8/CREDITS
+++ b/ext/oci8/CREDITS
@@ -1,2 +1,2 @@
OCI8
-Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson, Maxim Maletsky, Harald Radi, Antony Dovgal, Andi Gutmans, Wez Furlong
+Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson, Maxim Maletsky, Harald Radi, Antony Dovgal, Andi Gutmans, Wez Furlong, Christopher Jones, Oracle Corporation
diff --git a/ext/oci8/README b/ext/oci8/README
index 796de78cc5..de643ee72b 100644
--- a/ext/oci8/README
+++ b/ext/oci8/README
@@ -207,10 +207,9 @@ these steps:
6.2.0 Important: if Oracle Database 11.1.0.6 with DRCP connections is
used, then the Oracle database patch for bug 6474441 must be
- applied (see section 6.5) or a workaround below used. Without
- this patch, "ORA-01000: maximum open cursors exceeded", "ORA-01001
- invalid cursor" or "ORA-01002 fetch out of sequence" errors may
- occur.
+ applied (see section 6.5). Without this patch, "ORA-01000:
+ maximum open cursors exceeded", "ORA-01001 invalid cursor" or
+ "ORA-01002 fetch out of sequence" errors may occur.
If the Oracle 11.1.0.6 database patch cannot be applied, one of
the following three workarounds can be used to disable statement
@@ -325,7 +324,20 @@ Changing a password over DRCP connections will fail with the error
"ORA-56609: Usage not supported with DRCP". This is an documented
restriction of Oracle Database 11g.
-6.4.2 LOGON Triggers can be used to set session properties
+6.4.2 Closing Connections
+
+With the PHP 5.3 OCI8 Beta extension, persistent connections can now
+be closed by the user, allowing greater control over connection
+resource usage. Persistent connections will now also be closed
+automatically when there is no PHP variable referencing them, such as
+at the end of scope of a PHP user function. This will rollback any
+uncommitted transaction. These changes to persistent connections make
+them behave similarly to non-persistent connections, simplifying the
+interface, allowing for greater application consistency and
+predictability. Use oci8.old_oci_close_semantics=1 to retain the
+historical behavior.
+
+6.4.3 LOGON Triggers can be used to set session properties
The patch for Oracle Database 11.1.0.6 bug 6474441 (see section 6.5)
allows PHP applications with DRCP connection to use a database LOGON
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 456fa795f2..d85ce6f3de 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -27,13 +27,6 @@
*/
/* $Id$ */
-/* TODO
- *
- * file://localhost/www/docs/oci10/ociaahan.htm#423823 - implement lob_empty() with OCI_ATTR_LOBEMPTY
- *
- * get OCI_ATTR_CHARSET_ID attr of column to detect UTF string and multiply buffer in 4 times
- *
- */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -413,8 +406,9 @@ PHP_INI_END()
*/
/* {{{ php_oci_init_global_handles()
- Initialize global handles only when they are needed
-*/
+ *
+ * Initialize global handles only when they are needed
+ */
static void php_oci_init_global_handles(TSRMLS_D)
{
sword errcode;
@@ -460,8 +454,9 @@ oci_error:
} /* }}} */
/* {{{ php_oci_cleanup_global_handles()
- Free global handles (if they were initialized before)
-*/
+ *
+ * Free global handles (if they were initialized before)
+ */
static void php_oci_cleanup_global_handles(TSRMLS_D)
{
if (OCI_G(err)) {
@@ -476,8 +471,9 @@ static void php_oci_cleanup_global_handles(TSRMLS_D)
} /* }}} */
/* {{{ PHP_GINIT_FUNCTION
- Zerofill globals during module init
-*/
+ *
+ * Zerofill globals during module init
+ */
static PHP_GINIT_FUNCTION(oci)
{
memset(oci_globals, 0, sizeof(zend_oci_globals));
@@ -622,7 +618,6 @@ PHP_RINIT_FUNCTION(oci)
OCI_G(debug_mode) = 0; /* start "fresh" */
OCI_G(num_links) = OCI_G(num_persistent);
OCI_G(errcode) = 0;
- OCI_G(request_shutdown) = 0;
return SUCCESS;
}
@@ -647,7 +642,6 @@ PHP_MSHUTDOWN_FUNCTION(oci)
PHP_RSHUTDOWN_FUNCTION(oci)
{
/* Set this to indicate request shutdown for all further processing */
- OCI_G(request_shutdown) = 1;
#ifdef ZTS
zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_descriptor TSRMLS_CC);
@@ -659,7 +653,10 @@ PHP_RSHUTDOWN_FUNCTION(oci)
}
#endif
- /* check persistent connections and do the necessary actions if needed. If persistent_helper is unable to process a pconnection because of a refcount, the processing would happen from np-destructor which is called when refcount goes to zero - php_oci_pconnection_list_np_dtor*/
+ /* Check persistent connections and do the necessary actions if needed. If persistent_helper is
+ * unable to process a pconnection because of a refcount, the processing would happen from
+ * np-destructor which is called when refcount goes to zero - php_oci_pconnection_list_np_dtor
+ */
zend_hash_apply(&EG(persistent_list), (apply_func_t) php_oci_persistent_helper TSRMLS_CC);
#ifdef ZTS
@@ -685,26 +682,32 @@ PHP_MINFO_FUNCTION(oci)
php_info_print_table_row(2, "Active Connections", buf);
#if !defined(PHP_WIN32) && !defined(HAVE_OCI_INSTANT_CLIENT)
- php_info_print_table_row(2, "Oracle Version", PHP_OCI8_ORACLE_VERSION );
- php_info_print_table_row(2, "Compile-time ORACLE_HOME", PHP_OCI8_DIR );
- php_info_print_table_row(2, "Libraries Used", PHP_OCI8_SHARED_LIBADD );
+#ifdef PHP_OCI8_ORACLE_VERSION
+ php_info_print_table_row(2, "Oracle Version", PHP_OCI8_ORACLE_VERSION);
+#endif
+#ifdef PHP_OCI8_DIR
+ php_info_print_table_row(2, "Compile-time ORACLE_HOME", PHP_OCI8_DIR);
+#endif
+#ifdef PHP_OCI8_SHARED_LIBADD
+ php_info_print_table_row(2, "Libraries Used", PHP_OCI8_SHARED_LIBADD);
+#endif
#else
-# if defined(HAVE_OCI_INSTANT_CLIENT) && defined(OCI_MAJOR_VERSION) && defined(OCI_MINOR_VERSION)
+#if defined(HAVE_OCI_INSTANT_CLIENT) && defined(OCI_MAJOR_VERSION) && defined(OCI_MINOR_VERSION)
snprintf(buf, sizeof(buf), "%d.%d", OCI_MAJOR_VERSION, OCI_MINOR_VERSION);
php_info_print_table_row(2, "Oracle Instant Client Version", buf);
-# endif
+#endif
#endif
#ifdef HAVE_OCI8_TEMP_LOB
- php_info_print_table_row(2, "Temporary Lob support", "enabled" );
+ php_info_print_table_row(2, "Temporary Lob support", "enabled");
#else
- php_info_print_table_row(2, "Temporary Lob support", "disabled" );
+ php_info_print_table_row(2, "Temporary Lob support", "disabled");
#endif
#ifdef PHP_OCI8_HAVE_COLLECTIONS
- php_info_print_table_row(2, "Collections support", "enabled" );
+ php_info_print_table_row(2, "Collections support", "enabled");
#else
- php_info_print_table_row(2, "Collections support", "disabled" );
+ php_info_print_table_row(2, "Collections support", "disabled");
#endif
php_info_print_table_end();
@@ -716,7 +719,9 @@ PHP_MINFO_FUNCTION(oci)
/* list destructors {{{ */
/* {{{ php_oci_connection_list_dtor()
- Non-persistent connection destructor */
+ *
+ * Non-persistent connection destructor
+ */
static void php_oci_connection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
{
php_oci_connection *connection = (php_oci_connection *)entry->ptr;
@@ -728,7 +733,9 @@ static void php_oci_connection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
} /* }}} */
/* {{{ php_oci_pconnection_list_dtor()
- Persistent connection destructor */
+ *
+ * Persistent connection destructor
+ */
static void php_oci_pconnection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
{
php_oci_connection *connection = (php_oci_connection *)entry->ptr;
@@ -740,48 +747,67 @@ static void php_oci_pconnection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
} /* }}} */
/* {{{ php_oci_pconnection_list_np_dtor()
- Non-Persistent destructor for persistent connection - This gets invoked when
- the refcount of this goes to zero in the regular list */
+ *
+ * Non-Persistent destructor for persistent connection - This gets invoked when
+ * the refcount of this goes to zero in the regular list
+ */
static void php_oci_pconnection_list_np_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
{
php_oci_connection *connection = (php_oci_connection *)entry->ptr;
+ zend_rsrc_list_entry *le;
+
+ /*
+ * We cannot get connection as NULL or as a stub in this function. This is the function that
+ * turns a pconnection to a stub
+ *
+ * If oci_password_change() changed the password of a persistent connection, close the
+ * connection and remove it from the persistent connection cache. This means subsequent scripts
+ * will be prevented from being able to present the old (now invalid) password to a usable
+ * connection to the database; they must use the new password.
+ *
+ * Check for conditions that warrant removal of the hash entry
+ */
- /* We currently handle only session-pool using connections. TODO: Handle non-sessionpool connections as well */
- if (connection && connection->using_spool && !connection->is_stub) {
- zend_rsrc_list_entry *le;
+ if (!connection->is_open ||
+ connection->passwd_changed ||
+ (PG(connection_status) & PHP_CONNECTION_TIMEOUT) ||
+ OCI_G(in_call)) {
- if (!connection->is_open) {
- /* Remove the hash entry if present */
- if ((zend_hash_find(&EG(persistent_list), connection->hash_key, connection->hash_key_len + 1, (void **) &le)== SUCCESS) && (le->type == le_pconnection) && (le->ptr == connection)) {
- zend_hash_del(&EG(persistent_list), connection->hash_key, connection->hash_key_len + 1);
- }
- else {
- php_oci_connection_close(connection TSRMLS_CC);
- }
+ /* Remove the hash entry if present */
+ if ((zend_hash_find(&EG(persistent_list), connection->hash_key, connection->hash_key_len + 1, (void **) &le)== SUCCESS) && (le->type == le_pconnection) && (le->ptr == connection)) {
+ zend_hash_del(&EG(persistent_list), connection->hash_key, connection->hash_key_len + 1);
+ }
+ else {
+ php_oci_connection_close(connection TSRMLS_CC);
OCI_G(num_persistent)--;
+ }
- if (OCI_G(debug_mode)) {
- php_printf ("OCI8 DEBUG L1: np_dtor cleaning up: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__);
- }
+ if (OCI_G(debug_mode)) {
+ php_printf ("OCI8 DEBUG L1: np_dtor cleaning up: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__);
}
- else if (OCI_G(request_shutdown)){
- /* Release the connection to underlying pool - same steps
- * as the persistent helper. If we do this
- * unconditionally, we would change existing behavior
- * regarding out-of-scope pconnects. In future, we can
- * enable this through a new flag
- */
- php_oci_connection_release(connection TSRMLS_CC);
+ }
+ else {
+ /*
+ * Release the connection to underlying pool. We do this unconditionally so that
+ * out-of-scope pconnects are now consistent with oci_close and out-of-scope new connect
+ * semantics. With the PECL OCI 1.3.x extensions, we release pconnections when oci_close
+ * takes the refcount to zero.
+ *
+ * If oci_old_close_semantics is set, we artifically bump up the refcount and decremented
+ * only at request shutdown.
+ */
+ php_oci_connection_release(connection TSRMLS_CC);
- if (OCI_G(debug_mode)) {
- php_printf ("OCI8 DEBUG L1: np_dtor releasing: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__);
- }
+ if (OCI_G(debug_mode)) {
+ php_printf ("OCI8 DEBUG L1: np_dtor releasing: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__);
}
}
} /* }}} */
/* {{{ php_oci_statement_list_dtor()
- Statement destructor */
+ *
+ * Statement destructor
+ */
static void php_oci_statement_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
{
php_oci_statement *statement = (php_oci_statement *)entry->ptr;
@@ -789,7 +815,9 @@ static void php_oci_statement_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
} /* }}} */
/* {{{ php_oci_descriptor_list_dtor()
- Descriptor destructor */
+ *
+ * Descriptor destructor
+ */
static void php_oci_descriptor_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
{
php_oci_descriptor *descriptor = (php_oci_descriptor *)entry->ptr;
@@ -798,7 +826,9 @@ static void php_oci_descriptor_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
#ifdef PHP_OCI8_HAVE_COLLECTIONS
/* {{{ php_oci_collection_list_dtor()
- Collection destructor */
+ *
+ * Collection destructor
+ */
static void php_oci_collection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
{
php_oci_collection *collection = (php_oci_collection *)entry->ptr;
@@ -808,10 +838,12 @@ static void php_oci_collection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
/* }}} */
-/* hash destructors {{{ */
+/* Hash Destructors {{{ */
/* {{{ php_oci_define_hash_dtor()
- Define hash destructor */
+ *
+ * Define hash destructor
+ */
void php_oci_define_hash_dtor(void *data)
{
php_oci_define *define = (php_oci_define *) data;
@@ -826,7 +858,9 @@ void php_oci_define_hash_dtor(void *data)
/* }}} */
/* {{{ php_oci_bind_hash_dtor()
- Bind hash destructor */
+ *
+ * Bind hash destructor
+ */
void php_oci_bind_hash_dtor(void *data)
{
php_oci_bind *bind = (php_oci_bind *) data;
@@ -848,7 +882,9 @@ void php_oci_bind_hash_dtor(void *data)
/* }}} */
/* {{{ php_oci_column_hash_dtor()
- Column hash destructor */
+ *
+ * Column hash destructor
+ */
void php_oci_column_hash_dtor(void *data)
{
php_oci_out_column *column = (php_oci_out_column *) data;
@@ -873,7 +909,9 @@ void php_oci_column_hash_dtor(void *data)
/* }}} */
/* {{{ php_oci_descriptor_flush_hash_dtor()
- Flush descriptors on commit */
+ *
+ * Flush descriptors on commit
+ */
void php_oci_descriptor_flush_hash_dtor(void *data)
{
php_oci_descriptor *descriptor = *(php_oci_descriptor **)data;
@@ -888,7 +926,9 @@ void php_oci_descriptor_flush_hash_dtor(void *data)
/* }}} */
/* {{{ php_oci_descriptor_delete_from_hash()
- Delete descriptor from the hash */
+ *
+ * Delete descriptor from the hash
+ */
int php_oci_descriptor_delete_from_hash(void *data, void *id TSRMLS_DC)
{
php_oci_descriptor *descriptor = *(php_oci_descriptor **)data;
@@ -904,7 +944,9 @@ int php_oci_descriptor_delete_from_hash(void *data, void *id TSRMLS_DC)
/* }}} */
/* {{{ php_oci_error()
- Fetch & print out error message if we get an error */
+ *
+ * Fetch & print out error message if we get an error
+ */
sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC)
{
text *errbuf = (text *)NULL;
@@ -955,7 +997,9 @@ sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC)
/* }}} */
/* {{{ php_oci_fetch_errmsg()
- Fetch error message into the buffer from the error handle provided */
+ *
+ * Fetch error message into the buffer from the error handle provided
+ */
sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC)
{
sb4 error_code = 0;
@@ -1007,7 +1051,9 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC)
} /* }}} */
/* {{{ php_oci_fetch_sqltext_offset()
- Compute offset in the SQL statement */
+ *
+ * Compute offset in the SQL statement
+ */
int php_oci_fetch_sqltext_offset(php_oci_statement *statement, zstr *sqltext, ub2 *error_offset TSRMLS_DC)
{
ub4 sqltext_len = 0;
@@ -1038,7 +1084,9 @@ int php_oci_fetch_sqltext_offset(php_oci_statement *statement, zstr *sqltext, ub
} /* }}} */
/* {{{ php_oci_do_connect()
- Connect wrapper */
+ *
+ * Connect wrapper
+ */
void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclusive)
{
php_oci_connection *connection;
@@ -1065,7 +1113,10 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus
} /* }}} */
/* {{{ php_oci_do_connect_ex()
- * The real connect function. Allocates all the resources needed, establishes the connection and returns the result handle (or NULL) */
+ *
+ * The real connect function. Allocates all the resources needed, establishes the connection and
+ * returns the result handle (or NULL)
+ */
php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr password, int password_len, zstr new_password, int new_password_len, zstr dbname, int dbname_len, zstr charset, long session_mode, int persistent, int exclusive, zend_uchar type TSRMLS_DC)
{
zend_rsrc_list_entry *le;
@@ -1091,9 +1142,8 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Privileged connect is disabled. Enable oci8.privileged_connect to be able to connect as SYSOPER or SYSDBA");
return NULL;
}
- /* Increase security by not caching privileged
- * oci_pconnect() connections. The connection becomes
- * equivalent to oci_connect() or oci_new_connect().
+ /* Increase security by not caching privileged oci_pconnect() connections. The
+ * connection becomes equivalent to oci_connect() or oci_new_connect().
*/
persistent = 0;
break;
@@ -1103,9 +1153,8 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
break;
}
- /* We cannot use the new session create logic (OCISessionGet from
- * client-side session pool) when privileged connect or password
- * change is attempted. TODO: Remove this once OCI provides
+ /* We cannot use the new session create logic (OCISessionGet from client-side session pool) when
+ * privileged connect or password change is attempted. TODO: Remove this once OCI provides
* capability
*/
if ((session_mode == OCI_SYSOPER) || (session_mode == OCI_SYSDBA) || (new_password_len)) {
@@ -1219,11 +1268,10 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
}
} /* }}} */
- /* If we got a pconnection stub, then 'load'(OCISessionGet) the
- * real connection from its private spool
- * A connection is a stub if it is only a cached structure and the
- * real connection is released to its underlying private session pool.
- * We currently do not have stub support for non-persistent conns.
+ /* If we got a pconnection stub, then 'load'(OCISessionGet) the real connection from its
+ * private spool A connection is a stub if it is only a cached structure and the real
+ * connection is released to its underlying private session pool. We currently do not have
+ * stub support for non-persistent conns.
*
* TODO: put in negative code for non-persistent stubs
*/
@@ -1244,17 +1292,20 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
if (connection->is_persistent) {
int rsrc_type;
- /* check connection liveness in the following order:
+ /* Check connection liveness in the following order:
* 1) always check OCI_ATTR_SERVER_STATUS
* 2) see if it's time to ping it
* 3) ping it if needed
*/
if (php_oci_connection_status(connection TSRMLS_CC)) {
- /* only ping if:
+ /* Only ping if:
+ *
* 1) next_ping > 0, which means that ping_interval is not -1 (aka "Off")
- * 2) current_timestamp > next_ping, which means "it's time to check if it's still alive"
+ *
+ * 2) current_timestamp > next_ping, which means "it's time to check if it's
+ * still alive"
*/
- if ( !ping_done && (*(connection->next_pingp) > 0) && (timestamp >= *(connection->next_pingp)) && !php_oci_connection_ping(connection TSRMLS_CC) ) {
+ if (!ping_done && (*(connection->next_pingp) > 0) && (timestamp >= *(connection->next_pingp)) && !php_oci_connection_ping(connection TSRMLS_CC)) {
/* server died */
} else {
php_oci_connection *tmp;
@@ -1268,6 +1319,14 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
/* do nothing */
} else {
connection->rsrc_id = zend_list_insert(connection, le_pconnection);
+ /* Persistent connections: For old close semantics we artificially
+ * bump up the refcount to prevent the non-persistent destructor
+ * from getting called until request shutdown. The refcount is
+ * decremented in the persistent helper
+ */
+ if (OCI_G(old_oci_close_semantics)) {
+ zend_list_addref(connection->rsrc_id);
+ }
}
smart_str_free_ex(&hashed_details, 0);
return connection;
@@ -1282,20 +1341,27 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
}
} /* is_open is true? */
- /* Server died - connection not usable. The is_open=true can also fall through to here, if ping fails */
+ /* Server died - connection not usable. The is_open=true can also fall through to here,
+ * if ping fails
+ */
if (persistent){
int rsrc_type;
connection->is_open = 0;
connection->used_this_request = 1;
- /* We have to do a hash_del but need to preserve the resource if there is a positive refcount. Set the data pointer in the list entry to NULL */
- if (connection == zend_list_find(connection->rsrc_id, &rsrc_type)) {
+ /* We have to do a hash_del but need to preserve the resource if there is a positive
+ * refcount. Set the data pointer in the list entry to NULL
+ */
+ if (connection == zend_list_find(connection->rsrc_id, &rsrc_type) && rsrc_type == le_pconnection) {
le->ptr = NULL;
}
zend_hash_del(&EG(persistent_list), hashed_details.c, hashed_details.len+1);
} else {
+ /* We only remove the hash entry. The resource and the list entry with its pointer
+ * to the resource are still intact
+ */
zend_hash_del(&EG(regular_list), hashed_details.c, hashed_details.len+1);
}
@@ -1310,8 +1376,8 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
}
}
- /* Check if we have reached max_persistent. If so, try to remove a few
- * timed-out connections. As a last resort, return a non-persistent connection.
+ /* Check if we have reached max_persistent. If so, try to remove a few timed-out connections. As
+ * a last resort, return a non-persistent connection.
*/
if (persistent) {
zend_bool alloc_non_persistent = 0;
@@ -1345,13 +1411,14 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
connection->is_persistent = 0;
}
- /* {{{ Get the session pool that suits this connection request from the
- * persistent list. This step is only for non-persistent connections as
- * persistent connections have private session pools. Non-persistent conns
- * use shared session pool to allow for optimizations such as caching the
- * physical connection (for DRCP) even when the non-persistent php connection
- * is destroyed.
- * TODO: Unconditionally do this once OCI provides extended OCISessionGet capability */
+ /* {{{ Get the session pool that suits this connection request from the persistent list. This
+ * step is only for non-persistent connections as persistent connections have private session
+ * pools. Non-persistent conns use shared session pool to allow for optimizations such as
+ * caching the physical connection (for DRCP) even when the non-persistent php connection is
+ * destroyed.
+ *
+ * TODO: Unconditionally do this once OCI provides extended OCISessionGet capability
+ */
if (use_spool && !connection->is_persistent) {
if ((session_pool = php_oci_get_spool(username, username_len, password, password_len, dbname, dbname_len, charsetid ? charsetid:charsetid_nls_lang, type TSRMLS_CC))==NULL)
{
@@ -1363,7 +1430,7 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
connection->idle_expiry = (OCI_G(persistent_timeout) > 0) ? (timestamp + OCI_G(persistent_timeout)) : 0;
- /* mark password as unchanged by PHP during the duration of the database session */
+ /* Mark password as unchanged by PHP during the duration of the database session */
connection->passwd_changed = 0;
smart_str_free_ex(&hashed_details, 0);
@@ -1376,8 +1443,10 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
}
#endif
- /* Old session creation semantics when session pool cannot be used Eg: privileged connect/password change */
- if ( !use_spool) {
+ /* Old session creation semantics when session pool cannot be used Eg: privileged
+ * connect/password change
+ */
+ if (!use_spool) {
if (php_oci_old_create_session(connection, dbname, dbname_len, username, username_len, password, password_len, new_password, new_password_len, session_mode, type TSRMLS_CC)) {
php_oci_connection_close(connection TSRMLS_CC);
return NULL;
@@ -1390,7 +1459,7 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
}
}
- /* mark it as open */
+ /* Mark it as open */
connection->is_open = 1;
/* add to the appropriate hash */
@@ -1399,6 +1468,14 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
new_le.type = le_pconnection;
connection->used_this_request = 1;
connection->rsrc_id = zend_list_insert(connection, le_pconnection);
+
+ /* Persistent connections: For old close semantics we artificially bump up the refcount to
+ * prevent the non-persistent destructor from getting called until request shutdown. The
+ * refcount is decremented in the persistent helper
+ */
+ if (OCI_G(old_oci_close_semantics)) {
+ zend_list_addref(connection->rsrc_id);
+ }
zend_hash_update(&EG(persistent_list), connection->hash_key, connection->hash_key_len+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL);
OCI_G(num_persistent)++;
} else if (!exclusive) {
@@ -1427,16 +1504,17 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
/* }}} */
/* {{{ php_oci_connection_ping()
- * Ping connection. Uses OCIPing() or OCIServerVersion() depending on the Oracle Client version */
+ *
+ * Ping connection. Uses OCIPing() or OCIServerVersion() depending on the Oracle Client version
+ */
static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC)
{
- /* Use OCIPing instead of OCIServerVersion. If OCIPing returns
- * ORA-1010 (invalid OCI operation) such as from Pre-10.1 servers,
- * the error is still from the server and we would have
- * successfully performed a roundtrip and validated the
- * connection. Use OCIServerVersion for Pre-10.2 clients
+ /* Use OCIPing instead of OCIServerVersion. If OCIPing returns ORA-1010 (invalid OCI operation)
+ * such as from Pre-10.1 servers, the error is still from the server and we would have
+ * successfully performed a roundtrip and validated the connection. Use OCIServerVersion for
+ * Pre-10.2 clients
*/
-#if ( (OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2)) ) /* OCIPing available 10.2 onwards */
+#if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2))) /* OCIPing available 10.2 onwards */
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPing, (connection->svc, OCI_G(err), OCI_DEFAULT));
#else
char version[256];
@@ -1464,7 +1542,9 @@ static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC)
/* }}} */
/* {{{ php_oci_connection_status()
- Check connection status (pre-ping check) */
+ *
+ * Check connection status (pre-ping check)
+ */
static int php_oci_connection_status(php_oci_connection *connection TSRMLS_DC)
{
ub4 ss = 0;
@@ -1483,7 +1563,9 @@ static int php_oci_connection_status(php_oci_connection *connection TSRMLS_DC)
/* }}} */
/* {{{ php_oci_connection_rollback()
- Rollback connection */
+ *
+ * Rollback connection
+ */
int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC)
{
PHP_OCI_CALL_RETURN(connection->errcode, OCITransRollback, (connection->svc, connection->err, (ub4) 0));
@@ -1498,7 +1580,9 @@ int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC)
} /* }}} */
/* {{{ php_oci_connection_commit()
- Commit connection */
+ *
+ * Commit connection
+ */
int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC)
{
PHP_OCI_CALL_RETURN(connection->errcode, OCITransCommit, (connection->svc, connection->err, (ub4) 0));
@@ -1513,42 +1597,21 @@ int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC)
} /* }}} */
/* {{{ php_oci_connection_close()
- Close the connection and free all its resources */
+ *
+ * Close the connection and free all its resources
+ */
static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC)
{
int result = 0;
zend_bool in_call_save = OCI_G(in_call);
- if (connection->descriptors) {
- zend_hash_destroy(connection->descriptors);
- efree(connection->descriptors);
- }
-
- if (connection->svc) {
- /* rollback outstanding transactions */
- if (connection->needs_commit) {
- if (php_oci_connection_rollback(connection TSRMLS_CC)) {
- /* rollback failed */
- result = 1;
- }
- }
+ if (!connection->is_stub) {
+ /* Release resources associated with connection */
+ php_oci_connection_release(connection TSRMLS_CC);
}
- if (!connection->is_stub && connection->svc && connection->is_open) {
- /* Update the next_ping in the connection. Needed also for non-peristent because non-persistent DRCP caches connection underneath */
- if (OCI_G(ping_interval) >= 0) {
- *(connection->next_pingp) = time(NULL) + OCI_G(ping_interval);
- } else {
- /* ping_interval is -1 */
- *(connection->next_pingp) = 0;
- }
-
- /* Use OCISessionRelease for session pool connections */
- if (connection->using_spool) {
- PHP_OCI_CALL(OCISessionRelease, (connection->svc, connection->err, NULL,0, (ub4) 0));
- } else {
+ if (!connection->using_spool && connection->svc) {
PHP_OCI_CALL(OCISessionEnd, (connection->svc, connection->err, connection->session, (ub4) 0));
- }
}
if (connection->err) {
@@ -1603,14 +1666,19 @@ static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC)
} /* }}} */
/* {{{ php_oci_connection_release()
- Release the connection to its session pool. This looks similar to php_oci_connection_close, but the latter is used for connections that are to be terminated. The latter was not overloaded for "release" because of too many callers */
+ *
+ * Release the connection's resources. This involves freeing descriptors and rolling back
+ * transactions, setting timeout-related parameters etc. For session-pool using connections, the
+ * underlying connection is released to its session pool.
+ */
int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC)
{
int result = 0;
zend_bool in_call_save = OCI_G(in_call);
+ time_t timestamp = time(NULL);
- if (connection->is_stub || !connection->using_spool) {
- return 0; /* Not our concern */
+ if (connection->is_stub) {
+ return 0;
}
if (connection->descriptors) {
@@ -1629,32 +1697,56 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC)
}
}
- /* Release the session */
- if (connection->svc) {
+ if (OCI_G(persistent_timeout) > 0) {
+ connection->idle_expiry = timestamp + OCI_G(persistent_timeout);
+ }
+
+ /* We may have half-cooked connections to clean up */
+ if (connection->next_pingp) {
if (OCI_G(ping_interval) >= 0) {
- *(connection->next_pingp) = time(NULL) + OCI_G(ping_interval);
+ *(connection->next_pingp) = timestamp + OCI_G(ping_interval);
} else {
/* ping_interval is -1 */
*(connection->next_pingp) = 0;
}
-
- PHP_OCI_CALL(OCISessionRelease, (connection->svc, connection->err, NULL,
- 0, result ? OCI_SESSRLS_DROPSESS : OCI_DEFAULT));
}
- /* It no longer has relation with the database session. However authinfo and env are cached */
- connection->svc = NULL;
- connection->server = NULL;
- connection->session = NULL;
+ /* Release the session (stubs are filtered out at the beginning)*/
+ if (connection->using_spool) {
+ ub4 rlsMode = OCI_DEFAULT;
+
+ if (result) {
+ rlsMode |= OCI_SESSRLS_DROPSESS;
+ }
+
+ /* Sessions for non-persistent connections should be dropped. For 11 and above, the session
+ * pool has its own mechanism for doing so for purity NEW connections. We need to do so
+ * explicitly for 10.2 and earlier.
+ */
+#if (!(OCI_MAJOR_VERSION >= 11))
+ if (!connection->is_persistent) {
+ rlsMode |= OCI_SESSRLS_DROPSESS;
+ }
+#endif
- connection->is_attached = connection->is_open = connection->needs_commit = 0;
- connection->is_stub = 1;
+ if (connection->svc) {
+ PHP_OCI_CALL(OCISessionRelease, (connection->svc, connection->err, NULL,
+ 0, rlsMode));
+ }
+ /* It no longer has relation with the database session. However authinfo and env are
+ * cached
+ */
+ connection->svc = NULL;
+ connection->server = NULL;
+ connection->session = NULL;
- /* Cut the link between the connection structure and the time_t structure allocated within the OCI session */
- connection->next_pingp = NULL;
+ connection->is_attached = connection->is_open = connection->needs_commit = connection->used_this_request = 0;
+ connection->is_stub = 1;
- if (!connection->is_persistent) {
- OCI_G(num_links)--; /* Support for "connection" stubs - future use */
+ /* Cut the link between the connection structure and the time_t structure allocated within
+ * the OCI session
+ */
+ connection->next_pingp = NULL;
}
OCI_G(in_call) = in_call_save;
@@ -1662,7 +1754,9 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC)
} /* }}} */
/* {{{ php_oci_password_change()
- Change password for the user with the username given */
+ *
+ * Change password for the user with the username given
+ */
int php_oci_password_change(php_oci_connection *connection, zstr user, int user_len, zstr pass_old, int pass_old_len, zstr pass_new, int pass_new_len, zend_uchar type TSRMLS_DC)
{
PHP_OCI_CALL_RETURN(connection->errcode, OCIPasswordChange, (connection->svc, connection->err, (text *)user.s, USTR_BYTES(type, user_len), (text *)pass_old.s, USTR_BYTES(type, pass_old_len), (text *)pass_new.s, USTR_BYTES(type, pass_new_len), OCI_DEFAULT));
@@ -1677,7 +1771,9 @@ int php_oci_password_change(php_oci_connection *connection, zstr user, int user_
} /* }}} */
/* {{{ php_oci_server_get_version()
- Get Oracle server version */
+ *
+ * Get Oracle server version
+ */
int php_oci_server_get_version(php_oci_connection *connection, zstr *version TSRMLS_DC)
{
char version_buff[512];
@@ -1699,14 +1795,16 @@ int php_oci_server_get_version(php_oci_connection *connection, zstr *version TSR
} /* }}} */
/* {{{ php_oci_column_to_zval()
- Convert php_oci_out_column struct into zval */
+ *
+ * Convert php_oci_out_column struct into zval
+ */
int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSRMLS_DC)
{
php_oci_descriptor *descriptor;
ub4 lob_length;
int column_size;
- int lob_fetch_status;
zstr lob_buffer;
+ int lob_fetch_status;
zstr zstr_data = ZSTR(column->data);
php_oci_lob_type lob_type;
@@ -1795,7 +1893,9 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR
/* }}} */
/* {{{ php_oci_fetch_row()
- Fetch the next row from the given statement */
+ *
+ * Fetch the next row from the given statement
+ */
void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_args)
{
zval *z_statement, *array;
@@ -1891,9 +1991,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
}
if (expected_args > 2) {
- /* only for ocifetchinto BC
- * in all other cases we return array, not long
- */
+ /* Only for ocifetchinto BC. In all other cases we return array, not long */
REPLACE_ZVAL_VALUE(&array, return_value, 1); /* copy return_value to given reference */
zval_dtor(return_value);
RETURN_LONG(statement->ncolumns);
@@ -1902,81 +2000,25 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
/* }}} */
/* {{{ php_oci_persistent_helper()
- Helper function to close/rollback persistent connections at the end of request. A return value of 1 indicates that the connection is to be destroyed */
+ *
+ * Helper function to close/rollback persistent connections at the end of request. A return value of
+ * 1 indicates that the connection is to be destroyed
+ */
static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC)
{
time_t timestamp;
php_oci_connection *connection;
- int rsrc_type;
timestamp = time(NULL);
- /* pconnection stubs are also counted as they have private session pools */
+ /* Persistent connection stubs are also counted as they have private session pools */
if (le->type == le_pconnection) {
connection = (php_oci_connection *)le->ptr;
- if (connection->using_spool && (connection == zend_list_find(connection->rsrc_id, &rsrc_type)) && rsrc_type == le_pconnection){
- /* Do nothing - keep the connection as some one is referring to it. TODO: We should ideally have this for non-session_pool connections as well */
- if (OCI_G(debug_mode)) {
- php_printf ("OCI8 DEBUG L1: persistent_helper skipping : (%p) at (%s:%d) \n", connection, __FILE__, __LINE__);
- }
- }
- else if (connection->used_this_request) {
+ if (!connection->used_this_request && OCI_G(persistent_timeout) != -1) {
if (OCI_G(debug_mode)) {
- php_printf ("OCI8 DEBUG L1: persistent_helper processing : (%p stub=%d) at (%s:%d) \n", connection, connection->is_stub, __FILE__, __LINE__);
- }
-
- if ((PG(connection_status) & PHP_CONNECTION_TIMEOUT) || OCI_G(in_call)) {
- return ZEND_HASH_APPLY_REMOVE;
- }
-
- /* Helps remove bad connections from the persistent list */
- if (!connection->is_open && !connection->is_stub) {
- return ZEND_HASH_APPLY_REMOVE;
- }
-
- if (connection->descriptors) {
- zend_hash_destroy(connection->descriptors);
- efree(connection->descriptors);
- connection->descriptors = NULL;
- }
-
- if (connection->needs_commit) {
- php_oci_connection_rollback(connection TSRMLS_CC);
- }
-
- /* If oci_password_change() changed the password of a
- * persistent connection, close the connection and remove
- * it from the persistent connection cache. This means
- * subsequent scripts will be prevented from being able to
- * present the old (now invalid) password to a usable
- * connection to the database; they must use the new
- * password.
- */
- if (connection->passwd_changed) {
- return ZEND_HASH_APPLY_REMOVE;
- }
-
- if (OCI_G(persistent_timeout) > 0) {
- connection->idle_expiry = timestamp + OCI_G(persistent_timeout);
- }
-
- if (!connection->is_stub) {
- if (OCI_G(ping_interval) >= 0) {
- *(connection->next_pingp) = timestamp + OCI_G(ping_interval);
- } else {
- /* ping_interval is -1 */
- *(connection->next_pingp) = 0;
- }
-
- /* Release all session pool-using persistent connections at the end of the request */
- if (connection->using_spool && php_oci_connection_release(connection TSRMLS_CC)) {
- return ZEND_HASH_APPLY_REMOVE;
- }
+ php_printf ("OCI8 DEBUG L1: persistent_helper processing for timeout: (%p stub=%d) at (%s:%d) \n", connection, connection->is_stub, __FILE__, __LINE__);
}
-
- connection->used_this_request = 0;
- } else if (OCI_G(persistent_timeout) != -1) {
if (connection->idle_expiry < timestamp) {
/* connection has timed out */
return ZEND_HASH_APPLY_REMOVE;
@@ -1987,7 +2029,9 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC)
} /* }}} */
/* {{{ php_oci_create_spool()
- Create(alloc + Init) Session pool for the given dbname and charsetid */
+ *
+ * Create(alloc + Init) Session pool for the given dbname and charsetid
+ */
static php_oci_spool *php_oci_create_spool(zstr username, int username_len, zstr password, int password_len, zstr dbname, int dbname_len, char *hash_key, int hash_key_len, int charsetid, zend_uchar type TSRMLS_DC)
{
php_oci_spool *session_pool = NULL;
@@ -2018,10 +2062,9 @@ static php_oci_spool *php_oci_create_spool(zstr username, int username_len, zstr
goto exit_create_spool;
}
- /* allocate the session pool error handle - This only for use in the
- * destructor, as there is a generic bug which can free up the OCI_G(err)
- * variable before destroying connections. We cannot use this for other
- * roundtrip calls as there is no way the user can access this error
+ /* Allocate the session pool error handle - This only for use in the destructor, as there is a
+ * generic bug which can free up the OCI_G(err) variable before destroying connections. We
+ * cannot use this for other roundtrip calls as there is no way the user can access this error
*/
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, ((dvoid *) session_pool->env, (dvoid **)&(session_pool->err), (ub4) OCI_HTYPE_ERROR,(size_t) 0, (dvoid **) 0));
@@ -2031,15 +2074,15 @@ static php_oci_spool *php_oci_create_spool(zstr username, int username_len, zstr
goto exit_create_spool;
}
-/* Disable RLB as we'd mostly have single-connection pools */
-#if (OCI_MAJOR_VERSION > 10 )
+/* Disable RLB as we mostly have single-connection pools */
+#if (OCI_MAJOR_VERSION > 10)
poolmode = OCI_SPC_NO_RLB | OCI_SPC_HOMOGENEOUS;
#else
poolmode = OCI_SPC_HOMOGENEOUS;
#endif
- /* Create the homogeneous session pool - We have different session pools
- * for every different username, password, charset and dbname.
+ /* Create the homogeneous session pool - We have different session pools for every different
+ * username, password, charset and dbname.
*/
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionPoolCreate,(session_pool->env, OCI_G(err), session_pool->poolh, (OraText **)&session_pool->poolname, &session_pool->poolname_len, (OraText *)dbname.s, (ub4)USTR_BYTES(type, dbname_len), 0, UB4MAXVAL, 1,(OraText *)username.s, (ub4)USTR_BYTES(type, username_len), (OraText *)password.s,(ub4)USTR_BYTES(type, password_len), poolmode));
@@ -2076,9 +2119,10 @@ exit_create_spool:
} /* }}} */
/* {{{ php_oci_get_spool()
- Get Session pool for the given dbname and charsetid from the persistent
- list. Function called for non-persistent connections.
-*/
+ *
+ * Get Session pool for the given dbname and charsetid from the persistent list. Function called for
+ * non-persistent connections.
+ */
static php_oci_spool *php_oci_get_spool(zstr username, int username_len, zstr password, int password_len, zstr dbname, int dbname_len, int charsetid, zend_uchar type TSRMLS_DC)
{
smart_str spool_hashed_details = {0};
@@ -2111,7 +2155,7 @@ static php_oci_spool *php_oci_get_spool(zstr username, int username_len, zstr pa
php_strtolower(spool_hashed_details.c, spool_hashed_details.len);
/* }}} */
- if (zend_hash_find(&EG(persistent_list),spool_hashed_details.c, spool_hashed_details.len+1, (void **)&spool_out_le) == FAILURE ) {
+ if (zend_hash_find(&EG(persistent_list),spool_hashed_details.c, spool_hashed_details.len+1, (void **)&spool_out_le) == FAILURE) {
session_pool = php_oci_create_spool(username, username_len, password, password_len, dbname, dbname_len, spool_hashed_details.c, spool_hashed_details.len, charsetid, type TSRMLS_CC);
@@ -2125,7 +2169,7 @@ static php_oci_spool *php_oci_get_spool(zstr username, int username_len, zstr pa
zend_hash_update(&EG(persistent_list), session_pool->spool_hash_key, session_pool->spool_hash_key_len + 1, (void *)&spool_le, sizeof(zend_rsrc_list_entry),NULL);
} else if (spool_out_le->type == le_psessionpool &&
(((php_oci_spool *)(spool_out_le->ptr))->spool_hash_key_len) == spool_hashed_details.len &&
- memcmp(((php_oci_spool *)(spool_out_le->ptr))->spool_hash_key, spool_hashed_details.c, spool_hashed_details.len) == 0 ) {
+ memcmp(((php_oci_spool *)(spool_out_le->ptr))->spool_hash_key, spool_hashed_details.c, spool_hashed_details.len) == 0) {
/* retrieve the cached session pool */
session_pool = (php_oci_spool *)(spool_out_le->ptr);
}
@@ -2142,7 +2186,9 @@ exit_get_spool:
} /* }}} */
/* {{{ php_oci_create_env()
-Create the OCI environment choosing the correct function for the OCI version */
+ *
+ * Create the OCI environment choosing the correct function for the OCI version
+ */
static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC)
{
OCIEnv *retenv = NULL;
@@ -2182,7 +2228,10 @@ static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC)
}/* }}} */
/* {{{ php_oci_old_create_session()
- This function is to be deprecated in future in favour of OCISessionGet which is used in php_oci_do_connect_ex */
+ *
+ * This function is to be deprecated in future in favour of OCISessionGet which is used in
+ * php_oci_do_connect_ex
+ */
static int php_oci_old_create_session(php_oci_connection *connection, zstr dbname, int dbname_len, zstr username, int username_len, zstr password, int password_len, zstr new_password, int new_password_len, int session_mode, zend_uchar type TSRMLS_DC)
{
if (OCI_G(debug_mode)) {
@@ -2344,11 +2393,13 @@ static int php_oci_old_create_session(php_oci_connection *connection, zstr dbnam
} /* }}} */
/* {{{ php_oci_create_session()
- Create session using client-side session pool - new norm */
+ *
+ * Create session using client-side session pool - new norm
+ */
static int php_oci_create_session(php_oci_connection *connection, php_oci_spool *session_pool, zstr dbname, int dbname_len, zstr username, int username_len, zstr password, int password_len, zstr new_password, int new_password_len, int session_mode, zend_uchar type TSRMLS_DC)
{
php_oci_spool *actual_spool = NULL;
-#if (OCI_MAJOR_VERSION > 10 )
+#if (OCI_MAJOR_VERSION > 10)
ub4 purity = -2; /* Illegal value to initialize */
#endif
time_t timestamp = time(NULL);
@@ -2362,9 +2413,9 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool
connection->env = actual_spool->env;
- /* Do this upfront so that connection close on an error would know
- * that this is a session pool connection. Failure to do this
- * would result in crashes in error scenarios */
+ /* Do this upfront so that connection close on an error would know that this is a session pool
+ * connection. Failure to do this would result in crashes in error scenarios
+ */
if (!connection->using_spool) {
connection->using_spool = 1;
}
@@ -2377,9 +2428,9 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool
}
}
- /* The passed in "connection" can be a cached stub from plist or
- * freshly created. In the former case, we do not have to allocate
- * any handles */
+ /* The passed in "connection" can be a cached stub from plist or freshly created. In the former
+ * case, we do not have to allocate any handles
+ */
if (!connection->err) {
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->err), OCI_HTYPE_ERROR, 0, NULL));
@@ -2400,7 +2451,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool
}
/* Set the Connection class and purity if OCI client version >= 11g */
-#if (OCI_MAJOR_VERSION > 10 )
+#if (OCI_MAJOR_VERSION > 10)
PHP_OCI_CALL_RETURN(OCI_G(errcode),OCIAttrSet, ((dvoid *) connection->authinfo,(ub4) OCI_HTYPE_SESSION, (dvoid *) OCI_G(connection_class), (ub4)UG(unicode) ? USTR_BYTES(type, u_strlen((UChar *)OCI_G(connection_class))) : strlen(OCI_G(connection_class)), (ub4)OCI_ATTR_CONNECTION_CLASS, OCI_G(err)));
if (OCI_G(errcode) != OCI_SUCCESS) {
@@ -2431,14 +2482,11 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool
php_printf ("OCI8 DEBUG L1: (numopen=%d)(numbusy=%d) at (%s:%d) \n", numopen, numbusy, __FILE__, __LINE__);
} /* }}} */
- /* Ping loop: Ping and loop till we get a good
- * connection. When a database instance goes down, it can
- * leave several bad connections that need to be flushed out
- * before getting a good one. In non-RAC, we always get a
- * brand new connection at the end of the loop and in RAC, we
- * can get a good connection from a different instance before
- * flushing out all bad ones. We do not need to ping brand new
- * connections.
+ /* Ping loop: Ping and loop till we get a good connection. When a database instance goes
+ * down, it can leave several bad connections that need to be flushed out before getting a
+ * good one. In non-RAC, we always get a brand new connection at the end of the loop and in
+ * RAC, we can get a good connection from a different instance before flushing out all bad
+ * ones. We do not need to ping brand new connections.
*/
do {
/* Continue to use the global error handle as the connection is closed when an error occurs */
@@ -2447,8 +2495,8 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool
if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
- /* Session creation returns OCI_SUCCESS_WITH_INFO when
- * user's password has expired, but is still usable.
+ /* Session creation returns OCI_SUCCESS_WITH_INFO when user's password has expired, but
+ * is still usable.
*/
if (OCI_G(errcode) != OCI_SUCCESS_WITH_INFO) {
@@ -2508,7 +2556,9 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool
} /* }}} */
/* {{{ php_oci_spool_list_dtor()
- Session pool destructor function */
+ *
+ * Session pool destructor function
+ */
static void php_oci_spool_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
{
php_oci_spool *session_pool = (php_oci_spool *)entry->ptr;
@@ -2520,8 +2570,10 @@ static void php_oci_spool_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
return;
} /* }}} */
-/* {{{ php_oci_spool_close()
- Destroys the OCI Session Pool */
+/* {{{ php_oci_spool_close()
+ *
+ * Destroys the OCI Session Pool
+ */
static void php_oci_spool_close(php_oci_spool *session_pool TSRMLS_DC)
{
if (session_pool->poolname_len) {
@@ -2549,10 +2601,11 @@ static void php_oci_spool_close(php_oci_spool *session_pool TSRMLS_DC)
} /* }}} */
/* {{{ php_oci_ping_init()
- Initializes the next_ping time as a context value in the
- connection. We now use OCIContext{Get,Set}Value to store the
- next_ping because we need to support ping for non-persistent DRCP
- connections */
+ *
+ * Initializes the next_ping time as a context value in the connection. We now use
+ * OCIContext{Get,Set}Value to store the next_ping because we need to support ping for
+ * non-persistent DRCP connections
+ */
static sword php_oci_ping_init(php_oci_connection *connection, OCIError *errh TSRMLS_DC)
{
time_t *next_pingp = NULL;
@@ -2592,7 +2645,9 @@ static sword php_oci_ping_init(php_oci_connection *connection, OCIError *errh TS
#ifdef ZTS
/* {{{ php_oci_list_helper()
- Helper function to destroy data on thread shutdown in ZTS mode */
+ *
+ * Helper function to destroy data on thread shutdown in ZTS mode
+ */
static int php_oci_list_helper(zend_rsrc_list_entry *le, void *le_type TSRMLS_DC)
{
int type = (int) le_type;
diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c
index 02810bf577..a1ef6630cd 100644
--- a/ext/oci8/oci8_collection.c
+++ b/ext/oci8/oci8_collection.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 6 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
@@ -42,7 +42,7 @@
#include "php_oci8.h"
#include "php_oci8_int.h"
-/* {{{ php_oci_collection_create()
+/* {{{ php_oci_collection_create()
Create and return connection handle */
php_oci_collection * php_oci_collection_create(php_oci_connection *connection, zstr tdo, int tdo_len, zstr schema, int schema_len TSRMLS_DC)
{
@@ -87,7 +87,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, z
}
/* describe TDO */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDescribeAny,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIDescribeAny,
(
connection->svc,
connection->err,
@@ -112,7 +112,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, z
}
/* get the collection type code of the attribute */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
(
(dvoid*) parmp1,
(ub4) OCI_DTYPE_PARAM,
@@ -131,7 +131,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, z
case OCI_TYPECODE_TABLE:
case OCI_TYPECODE_VARRAY:
/* get collection element handle */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
(
(dvoid*) parmp1,
(ub4) OCI_DTYPE_PARAM,
@@ -147,7 +147,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, z
}
/* get REF of the TDO for the type */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
(
(dvoid*) parmp2,
(ub4) OCI_DTYPE_PARAM,
@@ -163,7 +163,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, z
}
/* get the TDO (only header) */
- PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByRef,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByRef,
(
connection->env,
connection->err,
@@ -179,7 +179,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, z
}
/* get typecode */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
(
(dvoid*) parmp2,
(ub4) OCI_DTYPE_PARAM,
@@ -201,16 +201,16 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, z
}
/* Create object to hold return table */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectNew,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectNew,
(
- connection->env,
- connection->err,
- connection->svc,
- OCI_TYPECODE_TABLE,
- collection->tdo,
- (dvoid *)0,
- OCI_DURATION_DEFAULT,
- TRUE,
+ connection->env,
+ connection->err,
+ connection->svc,
+ OCI_TYPECODE_TABLE,
+ collection->tdo,
+ (dvoid *)0,
+ OCI_DURATION_DEFAULT,
+ TRUE,
(dvoid **) &(collection->collection)
)
);
@@ -236,7 +236,7 @@ CLEANUP:
return NULL;
} /* }}} */
-/* {{{ php_oci_collection_size()
+/* {{{ php_oci_collection_size()
Return size of the collection */
int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC)
{
@@ -252,7 +252,7 @@ int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC)
return 0;
} /* }}} */
-/* {{{ php_oci_collection_max()
+/* {{{ php_oci_collection_max()
Return max number of elements in the collection */
int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC)
{
@@ -264,7 +264,7 @@ int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC)
return 0;
} /* }}} */
-/* {{{ php_oci_collection_trim()
+/* {{{ php_oci_collection_trim()
Trim collection to the given number of elements */
int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRMLS_DC)
{
@@ -280,7 +280,7 @@ int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRML
return 0;
} /* }}} */
-/* {{{ php_oci_collection_append_null()
+/* {{{ php_oci_collection_append_null()
Append NULL element to the end of the collection */
int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC)
{
@@ -298,7 +298,7 @@ int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC)
return 0;
} /* }}} */
-/* {{{ php_oci_collection_append_date()
+/* {{{ php_oci_collection_append_date()
Append DATE element to the end of the collection (use "DD-MON-YY" format) */
int php_oci_collection_append_date(php_oci_collection *collection, zstr date, int date_len TSRMLS_DC)
{
@@ -316,7 +316,7 @@ int php_oci_collection_append_date(php_oci_collection *collection, zstr date, in
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
(
connection->env,
connection->err,
@@ -358,7 +358,7 @@ int php_oci_collection_append_number(php_oci_collection *collection, zstr number
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
(
connection->env,
connection->err,
@@ -377,7 +377,7 @@ int php_oci_collection_append_number(php_oci_collection *collection, zstr number
return 0;
} /* }}} */
-/* {{{ php_oci_collection_append_string()
+/* {{{ php_oci_collection_append_string()
Append STRING to the end of the collection */
int php_oci_collection_append_string(php_oci_collection *collection, zstr element, int element_len TSRMLS_DC)
{
@@ -393,7 +393,7 @@ int php_oci_collection_append_string(php_oci_collection *collection, zstr elemen
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
(
connection->env,
connection->err,
@@ -412,7 +412,7 @@ int php_oci_collection_append_string(php_oci_collection *collection, zstr elemen
return 0;
} /* }}} */
-/* {{{ php_oci_collection_append()
+/* {{{ php_oci_collection_append()
Append wrapper. Appends any supported element to the end of the collection */
int php_oci_collection_append(php_oci_collection *collection, zstr element, int element_len TSRMLS_DC)
{
@@ -429,17 +429,17 @@ int php_oci_collection_append(php_oci_collection *collection, zstr element, int
return php_oci_collection_append_string(collection, element, element_len TSRMLS_CC);
break;
- case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
- case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
- case OCI_TYPECODE_REAL : /* REAL */
- case OCI_TYPECODE_DOUBLE : /* DOUBLE */
- case OCI_TYPECODE_INTEGER : /* INT */
- case OCI_TYPECODE_SIGNED16 : /* SHORT */
- case OCI_TYPECODE_SIGNED32 : /* LONG */
- case OCI_TYPECODE_DECIMAL : /* DECIMAL */
- case OCI_TYPECODE_FLOAT : /* FLOAT */
- case OCI_TYPECODE_NUMBER : /* NUMBER */
- case OCI_TYPECODE_SMALLINT : /* SMALLINT */
+ case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
+ case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
+ case OCI_TYPECODE_REAL : /* REAL */
+ case OCI_TYPECODE_DOUBLE : /* DOUBLE */
+ case OCI_TYPECODE_INTEGER : /* INT */
+ case OCI_TYPECODE_SIGNED16 : /* SHORT */
+ case OCI_TYPECODE_SIGNED32 : /* LONG */
+ case OCI_TYPECODE_DECIMAL : /* DECIMAL */
+ case OCI_TYPECODE_FLOAT : /* FLOAT */
+ case OCI_TYPECODE_NUMBER : /* NUMBER */
+ case OCI_TYPECODE_SMALLINT : /* SMALLINT */
return php_oci_collection_append_number(collection, element, element_len TSRMLS_CC);
break;
@@ -452,7 +452,7 @@ int php_oci_collection_append(php_oci_collection *collection, zstr element, int
return 1;
} /* }}} */
-/* {{{ php_oci_collection_element_get()
+/* {{{ php_oci_collection_element_get()
Get the element with the given index */
int php_oci_collection_element_get(php_oci_collection *collection, long index, zval **result_element TSRMLS_DC)
{
@@ -466,7 +466,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
MAKE_STD_ZVAL(*result_element);
ZVAL_NULL(*result_element);
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollGetElem,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCICollGetElem,
(
connection->env,
connection->err,
@@ -531,7 +531,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
if (UG(unicode)) {
ZVAL_UNICODEL(*result_element, (UChar *)str, TEXT_CHARS(str_len), 1);
- } else {
+ } else {
ZVAL_STRINGL(*result_element, (char *)str, str_len, 1);
}
}
@@ -539,17 +539,17 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
}
break;
- case OCI_TYPECODE_UNSIGNED16: /* UNSIGNED SHORT */
- case OCI_TYPECODE_UNSIGNED32: /* UNSIGNED LONG */
- case OCI_TYPECODE_REAL: /* REAL */
- case OCI_TYPECODE_DOUBLE: /* DOUBLE */
- case OCI_TYPECODE_INTEGER: /* INT */
- case OCI_TYPECODE_SIGNED16: /* SHORT */
- case OCI_TYPECODE_SIGNED32: /* LONG */
- case OCI_TYPECODE_DECIMAL: /* DECIMAL */
- case OCI_TYPECODE_FLOAT: /* FLOAT */
- case OCI_TYPECODE_NUMBER: /* NUMBER */
- case OCI_TYPECODE_SMALLINT: /* SMALLINT */
+ case OCI_TYPECODE_UNSIGNED16: /* UNSIGNED SHORT */
+ case OCI_TYPECODE_UNSIGNED32: /* UNSIGNED LONG */
+ case OCI_TYPECODE_REAL: /* REAL */
+ case OCI_TYPECODE_DOUBLE: /* DOUBLE */
+ case OCI_TYPECODE_INTEGER: /* INT */
+ case OCI_TYPECODE_SIGNED16: /* SHORT */
+ case OCI_TYPECODE_SIGNED32: /* LONG */
+ case OCI_TYPECODE_DECIMAL: /* DECIMAL */
+ case OCI_TYPECODE_FLOAT: /* FLOAT */
+ case OCI_TYPECODE_NUMBER: /* NUMBER */
+ case OCI_TYPECODE_SMALLINT: /* SMALLINT */
{
double double_number;
@@ -577,7 +577,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
return 1;
} /* }}} */
-/* {{{ php_oci_collection_element_set_null()
+/* {{{ php_oci_collection_element_set_null()
Set the element with the given index to NULL */
int php_oci_collection_element_set_null(php_oci_collection *collection, long index TSRMLS_DC)
{
@@ -595,7 +595,7 @@ int php_oci_collection_element_set_null(php_oci_collection *collection, long ind
return 0;
} /* }}} */
-/* {{{ php_oci_collection_element_set_date()
+/* {{{ php_oci_collection_element_set_date()
Change element's value to the given DATE */
int php_oci_collection_element_set_date(php_oci_collection *collection, long index, zstr date, int date_len TSRMLS_DC)
{
@@ -613,7 +613,7 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
(
connection->env,
connection->err,
@@ -656,7 +656,7 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
(
connection->env,
connection->err,
@@ -692,7 +692,7 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
(
connection->env,
connection->err,
@@ -729,17 +729,17 @@ int php_oci_collection_element_set(php_oci_collection *collection, long index, z
return php_oci_collection_element_set_string(collection, index, value, value_len TSRMLS_CC);
break;
- case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
- case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
- case OCI_TYPECODE_REAL : /* REAL */
- case OCI_TYPECODE_DOUBLE : /* DOUBLE */
- case OCI_TYPECODE_INTEGER : /* INT */
- case OCI_TYPECODE_SIGNED16 : /* SHORT */
- case OCI_TYPECODE_SIGNED32 : /* LONG */
- case OCI_TYPECODE_DECIMAL : /* DECIMAL */
- case OCI_TYPECODE_FLOAT : /* FLOAT */
- case OCI_TYPECODE_NUMBER : /* NUMBER */
- case OCI_TYPECODE_SMALLINT : /* SMALLINT */
+ case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
+ case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
+ case OCI_TYPECODE_REAL : /* REAL */
+ case OCI_TYPECODE_DOUBLE : /* DOUBLE */
+ case OCI_TYPECODE_INTEGER : /* INT */
+ case OCI_TYPECODE_SIGNED16 : /* SHORT */
+ case OCI_TYPECODE_SIGNED32 : /* LONG */
+ case OCI_TYPECODE_DECIMAL : /* DECIMAL */
+ case OCI_TYPECODE_FLOAT : /* FLOAT */
+ case OCI_TYPECODE_NUMBER : /* NUMBER */
+ case OCI_TYPECODE_SMALLINT : /* SMALLINT */
return php_oci_collection_element_set_number(collection, index, value, value_len TSRMLS_CC);
break;
@@ -752,7 +752,7 @@ int php_oci_collection_element_set(php_oci_collection *collection, long index, z
return 1;
} /* }}} */
-/* {{{ php_oci_collection_assign()
+/* {{{ php_oci_collection_assign()
Assigns a value to the collection from another collection */
int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_collection *collection_from TSRMLS_DC)
{
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index b1477b4b32..9bf35c5f92 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 6 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
@@ -491,7 +491,7 @@ PHP_FUNCTION(oci_lob_seek)
case PHP_OCI_SEEK_END:
if ((descriptor->lob_size + offset) >= 0) {
descriptor->lob_current_position = descriptor->lob_size + offset;
- }
+ }
else {
descriptor->lob_current_position = 0;
}
@@ -540,7 +540,7 @@ PHP_FUNCTION(oci_lob_write)
zval **tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
int data_len;
- long write_len = 0;
+ long write_len = 0;
ub4 bytes_written;
zstr data;
zend_uchar data_type;
@@ -1065,7 +1065,7 @@ PHP_FUNCTION(oci_lob_close)
RETURN_TRUE;
}
/* }}} */
-#endif
+#endif
/* {{{ proto object oci_new_descriptor(resource connection [, int type]) U
Initialize a new empty descriptor LOB/FILE (LOB is default) */
@@ -1288,7 +1288,7 @@ PHP_FUNCTION(oci_field_type_raw)
{
php_oci_out_column *column;
- column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
+ column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
if (column) {
RETURN_LONG(column->data_type);
}
@@ -1494,7 +1494,7 @@ PHP_FUNCTION(oci_fetch_all)
efree(columns);
efree(outarrs);
- }
+ }
RETURN_LONG(rows);
}
@@ -1558,17 +1558,15 @@ PHP_FUNCTION(oci_free_statement)
Disconnect from database */
PHP_FUNCTION(oci_close)
{
- /* oci_close for pconnect (if old_oci_close_semantics not set) would
- * release the connection back to the client-side session pool (and to the
+ /* oci_close for pconnect (if old_oci_close_semantics not set) would
+ * release the connection back to the client-side session pool (and to the
* server-side pool if Database Resident Connection Pool is being used).
* Subsequent pconnects in the same script are not guaranteed to get the
- * same database session. When a persistent connection goes out-of-scope,
- * the connection is not released to the session pool and is kept in the Plist
+ * same database session.
*/
zval *z_connection;
php_oci_connection *connection;
- int dummy_type = -1;
if (OCI_G(old_oci_close_semantics)) {
/* do nothing to keep BC */
@@ -1582,16 +1580,6 @@ PHP_FUNCTION(oci_close)
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
zend_list_delete(connection->rsrc_id);
- /* If refcount has fallen to zero(resource id removed from the list),
- * Release the OCI session associated with this connection structure back
- * to the underlying pool. The connection would be cached in the plist as a
- * stub
- */
- if(connection->is_persistent && connection->using_spool && !zend_list_find(connection->rsrc_id, &dummy_type)) {
-
- php_oci_connection_release(connection TSRMLS_CC);
- }
-
ZVAL_NULL(z_connection);
RETURN_TRUE;
@@ -2228,7 +2216,7 @@ PHP_FUNCTION(oci_new_collection)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rT|T", &z_connection, &tdo, &tdo_len, &tdo_type, &schema, &schema_len, &schema_type) == FAILURE) {
return;
}
-
+
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
if ( (collection = php_oci_collection_create(connection, tdo, tdo_len, schema, schema_len TSRMLS_CC)) ) {
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index cccad0dfe7..b6fbe89cf0 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 6 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
@@ -75,8 +75,8 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0));
if (OCI_G(errcode) != OCI_SUCCESS) {
- connection->errcode = php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
- PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
+ OCI_G(errcode) = php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, OCI_G(errcode));
efree(descriptor);
return NULL;
}
@@ -103,7 +103,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ
} /* }}} */
-/* {{{ php_oci_lob_get_length()
+/* {{{ php_oci_lob_get_length()
Get length of the LOB. The length is cached so we don't need to ask Oracle every time */
int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_DC)
{
@@ -229,7 +229,7 @@ static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, l
}
/* }}} */
-/* {{{ php_oci_lob_read()
+/* {{{ php_oci_lob_read()
Read specified portion of the LOB into the buffer */
int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long initial_offset, zstr *data, ub4 *data_len TSRMLS_DC)
{
@@ -262,7 +262,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
if (length <= 0) {
return 0;
}
-
+
if (initial_offset > length) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset must be less than size of the LOB");
return 1;
@@ -329,16 +329,16 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
connection->svc,
connection->err,
descriptor->descriptor,
- (oraub8 *)&bytes_read, /* IN/OUT bytes toread/read */
- (oraub8 *)&chars_read, /* IN/OUT chars toread/read */
- (oraub8) offset + 1, /* offset (starts with 1) */
+ (oraub8 *)&bytes_read, /* IN/OUT bytes toread/read */
+ (oraub8 *)&chars_read, /* IN/OUT chars toread/read */
+ (oraub8) offset + 1, /* offset (starts with 1) */
(dvoid *) bufp,
- (oraub8) buffer_size, /* size of buffer */
+ (oraub8) buffer_size, /* size of buffer */
OCI_FIRST_PIECE,
(dvoid *)&ctx,
- (OCICallbackLobRead2) php_oci_lob_callback, /* callback... */
- (ub2) descriptor->charset_id, /* The character set ID of the buffer data. */
- (ub1) descriptor->charset_form /* The character set form of the buffer data. */
+ (OCICallbackLobRead2) php_oci_lob_callback, /* callback... */
+ (ub2) descriptor->charset_id, /* The character set ID of the buffer data. */
+ (ub1) descriptor->charset_form /* The character set form of the buffer data. */
)
);
@@ -362,14 +362,14 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
connection->svc,
connection->err,
descriptor->descriptor,
- &bytes_read, /* IN/OUT bytes toread/read */
- offset + 1, /* offset (starts with 1) */
+ &bytes_read, /* IN/OUT bytes toread/read */
+ offset + 1, /* offset (starts with 1) */
(dvoid *) bufp,
- (ub4) buffer_size, /* size of buffer */
+ (ub4) buffer_size, /* size of buffer */
(dvoid *)&ctx,
- (OCICallbackLobRead) php_oci_lob_callback, /* callback... */
- (ub2) descriptor->charset_id, /* The character set ID of the buffer data. */
- (ub1) descriptor->charset_form /* The character set form of the buffer data. */
+ (OCICallbackLobRead) php_oci_lob_callback, /* callback... */
+ (ub2) descriptor->charset_id, /* The character set ID of the buffer data. */
+ (ub1) descriptor->charset_form /* The character set form of the buffer data. */
)
);
@@ -389,7 +389,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
return 1;
}
- descriptor->lob_current_position = (offset <= descriptor->lob_size) ? offset : descriptor->lob_size;
+ descriptor->lob_current_position = (offset <= descriptor->lob_size) ? offset : descriptor->lob_size;
if (descriptor->type == OCI_DTYPE_FILE) {
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
@@ -409,11 +409,11 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
return 0;
} /* }}} */
-/* {{{ php_oci_lob_write()
+/* {{{ php_oci_lob_write()
Write data to the LOB */
int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, zstr data, int data_len, ub4 *bytes_written TSRMLS_DC)
{
- OCILobLocator *lob = (OCILobLocator *) descriptor->descriptor;
+ OCILobLocator *lob = (OCILobLocator *) descriptor->descriptor;
php_oci_connection *connection = (php_oci_connection *) descriptor->connection;
ub4 lob_length;
ub4 data_len_out = data_len;
@@ -444,19 +444,19 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, zstr data, in
offset = descriptor->lob_current_position;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobWrite,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCILobWrite,
(
- connection->svc,
- connection->err,
- lob,
- (ub4 *)&data_len_out,
- (ub4) offset + 1,
- (dvoid *) (text *)data.s,
- (ub4) data_len,
- OCI_ONE_PIECE,
- (dvoid *)0,
- (OCICallbackLobWrite) 0,
- (ub2) descriptor->charset_id,
+ connection->svc,
+ connection->err,
+ lob,
+ (ub4 *)&data_len_out,
+ (ub4) offset + 1,
+ (dvoid *) (text *)data.s,
+ (ub4) data_len,
+ OCI_ONE_PIECE,
+ (dvoid *)0,
+ (OCICallbackLobWrite) 0,
+ (ub2) descriptor->charset_id,
(ub1) descriptor->charset_form
)
);
@@ -482,7 +482,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, zstr data, in
return 0;
} /* }}} */
-/* {{{ php_oci_lob_set_buffering()
+/* {{{ php_oci_lob_set_buffering()
Turn buffering off/onn for this particular LOB */
int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS_DC)
{
@@ -550,7 +550,7 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobCopy,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCILobCopy,
(
connection->svc,
connection->err,
@@ -571,7 +571,7 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d
return 0;
} /* }}} */
-/* {{{ php_oci_lob_close()
+/* {{{ php_oci_lob_close()
Close LOB */
int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
{
@@ -594,7 +594,7 @@ int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
return 0;
} /* }}} */
-/* {{{ php_oci_temp_lob_close()
+/* {{{ php_oci_temp_lob_close()
Close Temporary LOB */
int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
{
@@ -622,7 +622,7 @@ int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
} /* }}} */
-/* {{{ php_oci_lob_flush()
+/* {{{ php_oci_lob_flush()
Flush buffers for the LOB (only if they have been used) */
int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC)
{
@@ -715,20 +715,20 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC
}
while ((loblen = read(fp, &buf, sizeof(buf))) > 0) {
- PHP_OCI_CALL_RETURN(connection->errcode,
+ PHP_OCI_CALL_RETURN(connection->errcode,
OCILobWrite,
(
- connection->svc,
- connection->err,
- lob,
- &loblen,
- offset,
- (dvoid *) &buf,
- loblen,
- OCI_ONE_PIECE,
- (dvoid *)0,
- (OCICallbackLobWrite) 0,
- (ub2) descriptor->charset_id,
+ connection->svc,
+ connection->err,
+ lob,
+ &loblen,
+ offset,
+ (dvoid *) &buf,
+ loblen,
+ OCI_ONE_PIECE,
+ (dvoid *)0,
+ (OCICallbackLobWrite) 0,
+ (ub2) descriptor->charset_id,
(ub1) descriptor->charset_form
)
);
@@ -849,7 +849,7 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length,
return 0;
} /* }}} */
-/* {{{ php_oci_lob_is_equal()
+/* {{{ php_oci_lob_is_equal()
Compare two LOB descriptors and figure out if they are pointing to the same LOB */
int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descriptor *descriptor_second, boolean *result TSRMLS_DC)
{
@@ -867,12 +867,12 @@ int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descript
return 0;
} /* }}} */
-/* {{{ php_oci_lob_write_tmp()
+/* {{{ php_oci_lob_write_tmp()
Create temporary LOB and write data to it */
int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, zstr data, int data_len TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
- OCILobLocator *lob = descriptor->descriptor;
+ OCILobLocator *lob = descriptor->descriptor;
ub4 bytes_written = 0;
switch (type) {
@@ -890,7 +890,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, zstr data,
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobCreateTemporary,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCILobCreateTemporary,
(
connection->svc,
connection->err,
@@ -922,7 +922,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, zstr data,
return php_oci_lob_write(descriptor, 0, data, data_len, &bytes_written TSRMLS_CC);
} /* }}} */
-/* {{{ php_oci_lob_get_type()
+/* {{{ php_oci_lob_get_type()
Determine whether LOB is a CLOB or a BLOB */
int php_oci_lob_get_type(php_oci_descriptor *descriptor, php_oci_lob_type *lob_type TSRMLS_DC)
{
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index 1002b4885e..ce41ef2397 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 6 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
@@ -41,7 +41,7 @@
#include "php_oci8.h"
#include "php_oci8_int.h"
-/* {{{ php_oci_statement_create()
+/* {{{ php_oci_statement_create()
Create statemend handle and allocate necessary resources */
php_oci_statement *php_oci_statement_create (php_oci_connection *connection, zstr query, int query_len, zend_uchar type TSRMLS_DC)
{
@@ -62,7 +62,7 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, zst
if (query_len > 0) {
#if HAVE_OCI_STMT_PREPARE2
- PHP_OCI_CALL_RETURN(connection->errcode, OCIStmtPrepare2,
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIStmtPrepare2,
(
connection->svc,
&(statement->stmt),
@@ -126,7 +126,7 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, zst
/* {{{ php_oci_statement_set_prefetch()
Set prefetch buffer size for the statement (we're assuming that one row is ~1K sized) */
int php_oci_statement_set_prefetch(php_oci_statement *statement, long size TSRMLS_DC)
-{
+{
ub4 prefetch = size;
if (size < 1) {
@@ -146,7 +146,7 @@ int php_oci_statement_set_prefetch(php_oci_statement *statement, long size TSRML
}
/* }}} */
-/* {{{ php_oci_statement_fetch()
+/* {{{ php_oci_statement_fetch()
Fetch a row from the statement */
int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
{
@@ -194,7 +194,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
while (statement->errcode == OCI_NEED_DATA) {
if (piecewisecols) {
PHP_OCI_CALL_RETURN(statement->errcode,
- OCIStmtGetPieceInfo,
+ OCIStmtGetPieceInfo,
(
statement->stmt,
statement->err,
@@ -237,7 +237,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
}
}
- PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT));
+ PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT));
if (piecewisecols) {
for (i = 0; i < statement->ncolumns; i++) {
@@ -279,7 +279,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
}
/* }}} */
-/* {{{ php_oci_statement_get_column()
+/* {{{ php_oci_statement_get_column()
Get column from the result set */
php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, long column_index, zstr column_name, int column_name_len TSRMLS_DC)
{
@@ -331,7 +331,7 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
php_oci_statement *nested_stmt;
TSRMLS_FETCH();
- nested_stmt = php_oci_statement_create(outcol->statement->connection, NULL_ZSTR, 0, 0 TSRMLS_CC);
+ nested_stmt = php_oci_statement_create(outcol->statement->connection, NULL_ZSTR, 0, 0 TSRMLS_CC);
if (!nested_stmt) {
return OCI_ERROR;
}
@@ -349,7 +349,7 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
}
break;
case SQLT_RDD:
- case SQLT_BLOB:
+ case SQLT_BLOB:
case SQLT_CLOB:
case SQLT_BFILE: {
php_oci_descriptor *descr;
@@ -385,7 +385,7 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
}
/* }}} */
-/* {{{ php_oci_statement_execute()
+/* {{{ php_oci_statement_execute()
Execute statement */
int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
{
@@ -429,8 +429,8 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
iters = 1;
}
- if (statement->last_query) {
- /* if we execute refcursors we don't have a query and
+ if (statement->last_query) {
+ /* if we execute refcursors we don't have a query and
we don't want to execute!!! */
if (statement->binds) {
@@ -472,7 +472,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
if (statement->errcode != OCI_SUCCESS) {
statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
- return 1;
+ return 1;
}
statement->ncolumns = colcount;
@@ -484,7 +484,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
efree(statement->columns);
/* out of memory */
return 1;
- }
+ }
/* get column */
PHP_OCI_CALL_RETURN(statement->errcode, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)&param, counter));
@@ -515,7 +515,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
return 1;
}
- /* get character set id */
+ /* get character set id */
PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err));
if (statement->errcode != OCI_SUCCESS) {
@@ -532,7 +532,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
- return 1;
+ return 1;
}
outcol->storage_size4 = outcol->data_size;
@@ -597,9 +597,9 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
dynamic = OCI_DYNAMIC_FETCH;
break;
- case SQLT_RDD: /* ROWID */
- case SQLT_BLOB: /* binary LOB */
- case SQLT_CLOB: /* character LOB */
+ case SQLT_RDD: /* ROWID */
+ case SQLT_BLOB: /* binary LOB */
+ case SQLT_CLOB: /* character LOB */
case SQLT_BFILE: /* binary file LOB */
outcol->statement = statement; /* parent handle */
@@ -662,7 +662,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
}
if (dynamic == OCI_DYNAMIC_FETCH) {
- PHP_OCI_CALL_RETURN(statement->errcode,
+ PHP_OCI_CALL_RETURN(statement->errcode,
OCIDefineByPos,
(
statement->stmt, /* IN/OUT handle to the requested SQL query */
@@ -680,10 +680,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
);
} else {
- PHP_OCI_CALL_RETURN(statement->errcode,
+ PHP_OCI_CALL_RETURN(statement->errcode,
OCIDefineByPos,
(
- statement->stmt, /* IN/OUT handle to the requested SQL query */
+ statement->stmt, /* IN/OUT handle to the requested SQL query */
(OCIDefine **)&outcol->oci_define, /* IN/OUT pointer to a pointer to a define handle */
statement->err, /* IN/OUT An error handle */
counter, /* IN position in the select list */
@@ -708,11 +708,11 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
/* additional OCIDefineDynamic() call */
switch (outcol->data_type) {
case SQLT_RSET:
- case SQLT_RDD:
- case SQLT_BLOB:
+ case SQLT_RDD:
+ case SQLT_BLOB:
case SQLT_CLOB:
case SQLT_BFILE:
- PHP_OCI_CALL_RETURN(statement->errcode,
+ PHP_OCI_CALL_RETURN(statement->errcode,
OCIDefineDynamic,
(
outcol->oci_define,
@@ -731,7 +731,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
}
/* }}} */
-/* {{{ php_oci_statement_cancel()
+/* {{{ php_oci_statement_cancel()
Cancel statement */
int php_oci_statement_cancel(php_oci_statement *statement TSRMLS_DC)
{
@@ -740,11 +740,11 @@ int php_oci_statement_cancel(php_oci_statement *statement TSRMLS_DC)
} /* }}} */
-/* {{{ php_oci_statement_free()
+/* {{{ php_oci_statement_free()
Destroy statement handle and free associated resources */
void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC)
{
- if (statement->stmt) {
+ if (statement->stmt) {
#if HAVE_OCI_STMT_PREPARE2
if (statement->last_query_len) { /* FIXME: magical */
PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT));
@@ -791,7 +791,7 @@ void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC)
OCI_G(num_statements)--;
} /* }}} */
-/* {{{ php_oci_bind_pre_exec()
+/* {{{ php_oci_bind_pre_exec()
Helper function */
int php_oci_bind_pre_exec(void *data TSRMLS_DC)
{
@@ -799,13 +799,13 @@ int php_oci_bind_pre_exec(void *data TSRMLS_DC)
/* reset all bind stuff to a normal state..-. */
- bind->indicator = 0;
+ bind->indicator = 0;
return 0;
}
/* }}} */
-/* {{{ php_oci_bind_post_exec()
+/* {{{ php_oci_bind_post_exec()
Helper function */
int php_oci_bind_post_exec(void *data TSRMLS_DC)
{
@@ -933,7 +933,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
}
/* }}} */
-/* {{{ php_oci_bind_by_name()
+/* {{{ php_oci_bind_by_name()
Bind zval to the given placeholder */
int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len, zval* var, long maxlength, long type, zend_uchar uni_type TSRMLS_DC)
{
@@ -941,11 +941,11 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len,
php_oci_collection *bind_collection = NULL;
#endif
php_oci_descriptor *bind_descriptor = NULL;
- php_oci_statement *bind_statement = NULL;
- dvoid *oci_desc = NULL;
- /* dvoid *php_oci_collection = NULL; */
- OCIStmt *oci_stmt = NULL;
- dvoid *bind_data = NULL;
+ php_oci_statement *bind_statement = NULL;
+ dvoid *oci_desc = NULL;
+ /* dvoid *php_oci_collection = NULL; */
+ OCIStmt *oci_stmt = NULL;
+ dvoid *bind_data = NULL;
php_oci_bind bind, *old_bind, *bindp;
int mode = OCI_DATA_AT_EXEC;
sb4 value_sz = -1;
@@ -1008,7 +1008,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len,
case SQLT_BIN:
case SQLT_LNG:
case SQLT_AFC:
- case SQLT_CHR: /* SQLT_CHAR is the default value when type was not specified */
+ case SQLT_CHR: /* SQLT_CHR is the default value when type was not specified */
if (Z_TYPE_P(var) != IS_NULL) {
convert_to_text(var);
}
@@ -1046,7 +1046,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len,
break;
}
- if (value_sz == 0) {
+ if (value_sz == 0) {
value_sz = 1;
}
@@ -1069,25 +1069,25 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len,
bindp->statement = oci_stmt;
bindp->parent_statement = statement;
bindp->zval = var;
- zval_add_ref(&var);
+ zval_add_ref(&var);
- PHP_OCI_CALL_RETURN(statement->errcode,
+ PHP_OCI_CALL_RETURN(statement->errcode,
OCIBindByName,
(
- statement->stmt, /* statement handle */
- (OCIBind **)&bindp->bind, /* bind hdl (will alloc) */
- statement->err, /* error handle */
- (text*) name.s, /* placeholder name */
- USTR_BYTES(uni_type, name_len), /* placeholder length */
- (dvoid *)bind_data, /* in/out data */
+ statement->stmt, /* statement handle */
+ (OCIBind **)&bindp->bind, /* bind hdl (will alloc) */
+ statement->err, /* error handle */
+ (text*) name.s, /* placeholder name */
+ USTR_BYTES(uni_type, name_len), /* placeholder length */
+ (dvoid *)bind_data, /* in/out data */
TEXT_BYTES(value_sz), /* PHP_OCI_MAX_DATA_SIZE, */ /* max size of input/output data */
- (ub2)type, /* in/out data type */
- (dvoid *)&bindp->indicator, /* indicator (ignored) */
- (ub2 *)0, /* size array (ignored) */
- (ub2 *)&bindp->retcode, /* return code (ignored) */
- (ub4)0, /* maxarr_len (PL/SQL only?) */
- (ub4 *)0, /* actual array size (PL/SQL only?) */
- mode /* mode */
+ (ub2)type, /* in/out data type */
+ (dvoid *)&bindp->indicator, /* indicator (ignored) */
+ (ub2 *)0, /* size array (ignored) */
+ (ub2 *)&bindp->retcode, /* return code (ignored) */
+ (ub4)0, /* maxarr_len (PL/SQL only?) */
+ (ub4 *)0, /* actual array size (PL/SQL only?) */
+ mode /* mode */
)
);
@@ -1098,7 +1098,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len,
}
if (mode == OCI_DATA_AT_EXEC) {
- PHP_OCI_CALL_RETURN(statement->errcode, OCIBindDynamic,
+ PHP_OCI_CALL_RETURN(statement->errcode, OCIBindDynamic,
(
bindp->bind,
statement->err,
@@ -1119,7 +1119,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len,
#ifdef PHP_OCI8_HAVE_COLLECTIONS
if (type == SQLT_NTY) {
/* Bind object */
- PHP_OCI_CALL_RETURN(statement->errcode, OCIBindObject,
+ PHP_OCI_CALL_RETURN(statement->errcode, OCIBindObject,
(
bindp->bind,
statement->err,
@@ -1142,17 +1142,17 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len,
return 0;
} /* }}} */
-/* {{{ php_oci_bind_in_callback()
+/* {{{ php_oci_bind_in_callback()
Callback used when binding LOBs and VARCHARs */
sb4 php_oci_bind_in_callback(
- dvoid *ictxp, /* context pointer */
- OCIBind *bindp, /* bind handle */
- ub4 iter, /* 0-based execute iteration value */
- ub4 index, /* index of current array for PL/SQL or row index for SQL */
- dvoid **bufpp, /* pointer to data */
- ub4 *alenp, /* size after value/piece has been read */
- ub1 *piecep, /* which piece */
- dvoid **indpp) /* indicator value */
+ dvoid *ictxp, /* context pointer */
+ OCIBind *bindp, /* bind handle */
+ ub4 iter, /* 0-based execute iteration value */
+ ub4 index, /* index of current array for PL/SQL or row index for SQL */
+ dvoid **bufpp, /* pointer to data */
+ ub4 *alenp, /* size after value/piece has been read */
+ ub1 *piecep, /* which piece */
+ dvoid **indpp) /* indicator value */
{
php_oci_bind *phpbind;
zval *val;
@@ -1169,9 +1169,9 @@ sb4 php_oci_bind_in_callback(
*bufpp = 0;
*alenp = -1;
*indpp = (dvoid *)&phpbind->indicator;
- } else if ((phpbind->descriptor == 0) && (phpbind->statement == 0)) {
+ } else if ((phpbind->descriptor == 0) && (phpbind->statement == 0)) {
/* "normal string bind */
- convert_to_text(val);
+ convert_to_text(val);
if (UG(unicode)) {
*bufpp = Z_UNIVAL_P(val).v;
@@ -1186,7 +1186,7 @@ sb4 php_oci_bind_in_callback(
*bufpp = phpbind->statement;
*alenp = -1; /* seems to be allright */
*indpp = (dvoid *)&phpbind->indicator;
- } else {
+ } else {
/* descriptor bind */
*bufpp = phpbind->descriptor;
*alenp = -1; /* seems to be allright */
@@ -1201,15 +1201,15 @@ sb4 php_oci_bind_in_callback(
/* {{{ php_oci_bind_out_callback()
Callback used when binding LOBs and VARCHARs */
sb4 php_oci_bind_out_callback(
- dvoid *octxp, /* context pointer */
- OCIBind *bindp, /* bind handle */
- ub4 iter, /* 0-based execute iteration value */
- ub4 index, /* index of current array for PL/SQL or row index for SQL */
- dvoid **bufpp, /* pointer to data */
- ub4 **alenpp, /* size after value/piece has been read */
- ub1 *piecep, /* which piece */
- dvoid **indpp, /* indicator value */
- ub2 **rcodepp) /* return code */
+ dvoid *octxp, /* context pointer */
+ OCIBind *bindp, /* bind handle */
+ ub4 iter, /* 0-based execute iteration value */
+ ub4 index, /* index of current array for PL/SQL or row index for SQL */
+ dvoid **bufpp, /* pointer to data */
+ ub4 **alenpp, /* size after value/piece has been read */
+ ub1 *piecep, /* which piece */
+ dvoid **indpp, /* indicator value */
+ ub2 **rcodepp) /* return code */
{
php_oci_bind *phpbind;
zval *val;
@@ -1243,7 +1243,7 @@ sb4 php_oci_bind_out_callback(
*rcodepp = &phpbind->retcode;
*indpp = &phpbind->indicator;
retval = OCI_CONTINUE;
- } else {
+ } else {
if (UG(unicode)) {
convert_to_unicode(val);
zval_dtor(val);
@@ -1251,13 +1251,13 @@ sb4 php_oci_bind_out_callback(
Z_UNILEN_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */
Z_UNIVAL_P(val).v = ecalloc(1, UBYTES(Z_UNILEN_P(phpbind->zval) + 1));
- *alenpp = (ub4*) &Z_UNILEN_P(phpbind->zval);
+ *alenpp = (ub4*) &Z_UNILEN_P(phpbind->zval);
*bufpp = Z_UNIVAL_P(phpbind->zval).v;
*piecep = OCI_ONE_PIECE;
*rcodepp = &phpbind->retcode;
*indpp = &phpbind->indicator;
retval = OCI_CONTINUE;
- } else {
+ } else {
convert_to_string(val);
zval_dtor(val);
@@ -1265,7 +1265,7 @@ sb4 php_oci_bind_out_callback(
Z_STRVAL_P(val) = ecalloc(1, Z_STRLEN_P(phpbind->zval) + 1);
/* XXX we assume that zend-zval len has 4 bytes */
- *alenpp = (ub4*) &Z_STRLEN_P(phpbind->zval);
+ *alenpp = (ub4*) &Z_STRLEN_P(phpbind->zval);
*bufpp = Z_STRVAL_P(phpbind->zval);
*piecep = OCI_ONE_PIECE;
*rcodepp = &phpbind->retcode;
@@ -1277,7 +1277,7 @@ sb4 php_oci_bind_out_callback(
}
/* }}} */
-/* {{{ php_oci_statement_get_column_helper()
+/* {{{ php_oci_statement_get_column_helper()
Helper function to get column by name and index */
php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data)
{
@@ -1337,7 +1337,7 @@ int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC
return 0;
} /* }}} */
-/* {{{ php_oci_statement_get_numrows()
+/* {{{ php_oci_statement_get_numrows()
Get the number of rows fetched to the clientside (NOT the number of rows in the result set) */
int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSRMLS_DC)
{
@@ -1358,7 +1358,7 @@ int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSR
return 0;
} /* }}} */
-/* {{{ php_oci_bind_array_by_name()
+/* {{{ php_oci_bind_array_by_name()
Bind arrays to PL/SQL types */
int php_oci_bind_array_by_name(php_oci_statement *statement, zstr name, int name_len, zval* var, long max_table_length, long maxlength, long type, zend_uchar uni_type TSRMLS_DC)
{
@@ -1423,15 +1423,15 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, zstr name, int name
bindp->array.type = type;
zval_add_ref(&var);
- PHP_OCI_CALL_RETURN(statement->errcode,
- OCIBindByName,
+ PHP_OCI_CALL_RETURN(statement->errcode,
+ OCIBindByName,
(
statement->stmt,
(OCIBind **)&bindp->bind,
statement->err,
(text *)name.s,
USTR_BYTES(uni_type, name_len),
- (dvoid *) bindp->array.elements,
+ (dvoid *) bindp->array.elements,
(sb4) bind->array.max_length,
type,
(dvoid *)bindp->array.indicators,
@@ -1454,7 +1454,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, zstr name, int name
return 0;
} /* }}} */
-/* {{{ php_oci_bind_array_helper_string()
+/* {{{ php_oci_bind_array_helper_string()
Bind arrays to PL/SQL types */
php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, long maxlength TSRMLS_DC)
{
@@ -1489,7 +1489,7 @@ php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length,
bind->array.max_length = TEXT_BYTES(maxlength);
bind->array.element_lengths = safe_emalloc(max_table_length, sizeof(ub2), 0);
memset(bind->array.element_lengths, 0, max_table_length * sizeof(ub2));
- bind->array.indicators = safe_emalloc(max_table_length, sizeof(sb2), 0);
+ bind->array.indicators = safe_emalloc(max_table_length, sizeof(sb2), 0);
memset(bind->array.indicators, 0, max_table_length*sizeof(sb2));
zend_hash_internal_pointer_reset(hash);
@@ -1497,7 +1497,7 @@ php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length,
for (i = 0; i < bind->array.current_length; i++) {
if (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) {
convert_to_text_ex(entry);
- bind->array.element_lengths[i] = TEXT_BYTES(Z_UNILEN_PP(entry));
+ bind->array.element_lengths[i] = TEXT_BYTES(Z_UNILEN_PP(entry));
if (Z_UNILEN_PP(entry) == 0) {
bind->array.indicators[i] = -1;
}
@@ -1510,7 +1510,7 @@ php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length,
zend_hash_internal_pointer_reset(hash);
for (i = 0; i < max_table_length; i++) {
if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
- int element_length;
+ int element_length;
convert_to_text_ex(entry);
element_length = (maxlength > Z_UNILEN_PP(entry)) ? Z_UNILEN_PP(entry) : maxlength;
@@ -1532,7 +1532,7 @@ php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length,
return bind;
} /* }}} */
-/* {{{ php_oci_bind_array_helper_number()
+/* {{{ php_oci_bind_array_helper_number()
Bind arrays to PL/SQL types */
php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length TSRMLS_DC)
{
@@ -1570,7 +1570,7 @@ php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length
return bind;
} /* }}} */
-/* {{{ php_oci_bind_array_helper_double()
+/* {{{ php_oci_bind_array_helper_double()
Bind arrays to PL/SQL types */
php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length TSRMLS_DC)
{
@@ -1608,7 +1608,7 @@ php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length
return bind;
} /* }}} */
-/* {{{ php_oci_bind_array_helper_date()
+/* {{{ php_oci_bind_array_helper_date()
Bind arrays to PL/SQL types */
php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, php_oci_connection *connection TSRMLS_DC)
{
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index 9058aacb7e..a05538e47d 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 6 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
@@ -36,10 +36,10 @@
#endif
-/*
+/*
* The version of the OCI8 extension.
*/
-#define PHP_OCI8_VERSION "1.3.1 Beta"
+#define PHP_OCI8_VERSION "1.3.2 Beta"
extern zend_module_entry oci8_module_entry;
#define phpext_oci8_ptr &oci8_module_entry
@@ -64,5 +64,3 @@ PHP_MINFO_FUNCTION(oci);
* c-basic-offset: 4
* End:
*/
-
-
diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index 8e4157d5d8..e40d44dd54 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -267,13 +267,22 @@ typedef struct { /* php_oci_out_column {{{ */
OCI_G(in_call) = 0; \
} while (0)
+/* Check for errors that indicate the connection to the DB is no
+ * longer valid. If it isn't, then the PHP connection is marked to be
+ * reopened by the next PHP OCI8 connect command. This is most useful
+ * for persistent connections. The error number list is not
+ * exclusive. The error number comparisons and the
+ * OCI_ATTR_SERVER_STATUS check are done for maximum cross-version
+ * compatibility. In the far future, only the attribute check will be
+ * needed.
+ */
#define PHP_OCI_HANDLE_ERROR(connection, errcode) \
do { \
switch (errcode) { \
case 1013: \
zend_bailout(); \
break; \
- case 22: \
+ case 22: \
case 378: \
case 602: \
case 603: \
@@ -296,7 +305,7 @@ typedef struct { /* php_oci_out_column {{{ */
(connection)->is_open = 0; \
break; \
default: \
- { /* do both numeric checks (above) and the status check for maximum version compatibility */ \
+ { \
ub4 serverStatus = OCI_SERVER_NORMAL; \
PHP_OCI_CALL(OCIAttrGet, ((dvoid *)(connection)->server, OCI_HTYPE_SERVER, (dvoid *)&serverStatus, \
(ub4 *)0, OCI_ATTR_SERVER_STATUS, (connection)->err)); \
@@ -472,7 +481,6 @@ ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ */
zend_bool old_oci_close_semantics; /* old_oci_close_semantics flag (to determine the way oci_close() should behave) */
int shutdown; /* in shutdown flag */
- int request_shutdown; /* in request shutdown flag */
OCIEnv *env; /* global environment handle */
diff --git a/ext/oci8/tests/bug43497.phpt b/ext/oci8/tests/bug43497.phpt
index 908fe58972..0fc6a97b35 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 0000000000..e2cb1ce486
--- /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 646f09b7c7..d6c2978635 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/drcp_cclass1.phpt b/ext/oci8/tests/drcp_cclass1.phpt
index 4036da773f..ff45f73f73 100644
--- a/ext/oci8/tests/drcp_cclass1.phpt
+++ b/ext/oci8/tests/drcp_cclass1.phpt
@@ -3,14 +3,14 @@ DRCP: Test setting connection class inline
--SKIPIF--
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
-require(__DIR__."/details.inc");
+require(dirname(__FILE__)."/details.inc");
if (!$test_drcp) die("skip testing DRCP connection class only works in DRCP mode");
if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
?>
--FILE--
<?php
-require(__DIR__."/details.inc");
+require(dirname(__FILE__)."/details.inc");
// Initialization
diff --git a/ext/oci8/tests/drcp_connect1.phpt b/ext/oci8/tests/drcp_connect1.phpt
index d639d5684e..bf619a4efd 100644
--- a/ext/oci8/tests/drcp_connect1.phpt
+++ b/ext/oci8/tests/drcp_connect1.phpt
@@ -1,11 +1,7 @@
--TEST--
DRCP: oci_connect()
--SKIPIF--
-<?php
-if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/details.inc");
-if (!$test_drcp) die("skip expected test results are only valid for DRCP Mode");
-?>
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--INI--
oci8.connection_class=test
oci8.old_oci_close_semantics=0
@@ -54,7 +50,7 @@ drcp_set_packagevar($pconn1,1000);
oci_close($pconn1);
echo " Connection pconn1 closed....\n";
-// Second conenction with oci_pconnect should return the same session hence the
+// 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));
diff --git a/ext/oci8/tests/drcp_scope1.phpt b/ext/oci8/tests/drcp_scope1.phpt
index 01b0a4271e..57f1abe327 100644
--- a/ext/oci8/tests/drcp_scope1.phpt
+++ b/ext/oci8/tests/drcp_scope1.phpt
@@ -19,6 +19,7 @@ require dirname(__FILE__)."/details.inc";
// Create the table
$c = oci_new_connect($user,$password,$dbase);
+@drcp_drop_table($c);
drcp_create_table($c);
// OCI_NEW_CONNECT
diff --git a/ext/oci8/tests/drcp_scope2.phpt b/ext/oci8/tests/drcp_scope2.phpt
index cb5dcd1ac1..b72e00dbb0 100644
--- a/ext/oci8/tests/drcp_scope2.phpt
+++ b/ext/oci8/tests/drcp_scope2.phpt
@@ -19,6 +19,7 @@ require dirname(__FILE__)."/details.inc";
// Create the table
$c = oci_new_connect($user,$password,$dbase);
+@drcp_drop_table($c);
drcp_create_table($c);
// OCI_NEW_CONNECT
diff --git a/ext/oci8/tests/drcp_scope3.phpt b/ext/oci8/tests/drcp_scope3.phpt
new file mode 100644
index 0000000000..b448a518ad
--- /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 0000000000..07110bca0e
--- /dev/null
+++ b/ext/oci8/tests/drcp_scope4.phpt
@@ -0,0 +1,57 @@
+--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 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 txn is rolled
+// back and hence the updated value will not be reflected 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 HR
+Done
diff --git a/ext/oci8/tests/drcp_scope5.phpt b/ext/oci8/tests/drcp_scope5.phpt
new file mode 100644
index 0000000000..832e6aa8cb
--- /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/password.phpt b/ext/oci8/tests/password.phpt
index a7de393a25..7133d8bae8 100644
--- a/ext/oci8/tests/password.phpt
+++ b/ext/oci8/tests/password.phpt
@@ -1,27 +1,75 @@
--TEST--
-oci_password_change()
+oci_password_change() for non-persistent connections
--SKIPIF--
<?php
-if (!extension_loaded('oci8')) die("skip no oci8 extension");
+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");
if ($test_drcp) die("skip password change not supported in DRCP Mode");
?>
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
+require(dirname(__FILE__)."/details.inc");
-$new_password = "test";
-var_dump(oci_password_change($dbase, $user, $password, $new_password));
+// 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");
+
+// 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";
@@ -30,4 +78,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 3ee2db5b40..71423e717b 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");
if ($test_drcp) die("skip password change not supported in DRCP Mode");
?>
@@ -28,34 +29,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[0]; /* 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[0]; /* 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[0]; /* resource number */
+$rn3 = (int)$c3;
// Connections should differ
if ($rn1 == $rn2) {
@@ -77,10 +63,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 1de3cb4c96..e8642abca7 100644
--- a/ext/oci8/tests/password_new.phpt
+++ b/ext/oci8/tests/password_new.phpt
@@ -3,8 +3,23 @@ oci_password_change()
--SKIPIF--
<?php
if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require dirname(__FILE__)."/details.inc";
+require dirname(__FILE__)."/connect.inc";
+if (empty($dbase)) die ("skip requires database connection string be set");
if ($test_drcp) die("skip password change not supported in DRCP Mode");
+
+// 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 7a2df841e7..157bdebcaa 100644
--- a/ext/oci8/tests/password_old.phpt
+++ b/ext/oci8/tests/password_old.phpt
@@ -3,8 +3,23 @@ ocipasswordchange()
--SKIPIF--
<?php
if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require dirname(__FILE__)."/details.inc";
+require dirname(__FILE__)."/connect.inc";
+if (empty($dbase)) die ("skip requires database connection string be set");
if ($test_drcp) die("skip password change not supported in DRCP Mode");
+
+// 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
@@ -12,7 +27,7 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode");
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));
@@ -21,14 +36,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 c9d6b14b33..737ef8ec00 100644
--- a/ext/oci8/tests/pecl_bug10194_blob.phpt
+++ b/ext/oci8/tests/pecl_bug10194_blob.phpt
@@ -1,9 +1,9 @@
--TEST--
PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback)
--SKIPIF--
-<?php
+<?php
if (!extension_loaded('oci8')) die("skip no oci8 extension");
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
?>
--INI--
memory_limit=9M
diff --git a/ext/oci8/tests/pecl_bug10194_blob_64.phpt b/ext/oci8/tests/pecl_bug10194_blob_64.phpt
index 9b98989f38..433d586a4e 100644
--- a/ext/oci8/tests/pecl_bug10194_blob_64.phpt
+++ b/ext/oci8/tests/pecl_bug10194_blob_64.phpt
@@ -3,7 +3,7 @@ PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside
--SKIPIF--
<?php
if (!extension_loaded('oci8')) die("skip no oci8 extension");
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only");
?>
--INI--
memory_limit=6M
diff --git a/ext/oci8/tests/testping.phpt b/ext/oci8/tests/testping.phpt
index 1556d81d1e..a0d65a30c3 100644
--- a/ext/oci8/tests/testping.phpt
+++ b/ext/oci8/tests/testping.phpt
@@ -7,7 +7,7 @@ oci8.ping_interval=0
--FILE--
<?php
-require(__DIR__.'/details.inc');
+require(dirname(__FILE__).'/details.inc');
for ($i = 0; $i < 2; $i++) {
if (!empty($dbase)) {