summaryrefslogtreecommitdiff
path: root/ext/oci8
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:38:07 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:38:07 -0400
commitbb01389fbd53ec1cbcb80d0681a37cca1267891a (patch)
tree4783178fca65a5d9071c8df34f2ddc3d31728673 /ext/oci8
parenteddbbea4325e602ddc87c545531609132d4f0e3b (diff)
downloadphp-bb01389fbd53ec1cbcb80d0681a37cca1267891a.tar.gz
Imported Upstream version 5.2.4upstream/5.2.4
Diffstat (limited to 'ext/oci8')
-rw-r--r--ext/oci8/README99
-rw-r--r--ext/oci8/config.m463
-rw-r--r--ext/oci8/oci8.c58
-rw-r--r--ext/oci8/oci8_collection.c30
-rw-r--r--ext/oci8/oci8_interface.c55
-rw-r--r--ext/oci8/oci8_lob.c25
-rw-r--r--ext/oci8/oci8_statement.c41
-rw-r--r--ext/oci8/package2.xml154
-rw-r--r--ext/oci8/php_oci8_int.h8
-rw-r--r--ext/oci8/tests/bug42134.phpt100
-rw-r--r--ext/oci8/tests/bug42173.phpt168
-rw-r--r--ext/oci8/tests/details.inc31
-rw-r--r--ext/oci8/tests/field_funcs.phpt6
-rw-r--r--ext/oci8/tests/field_funcs2.phpt70
-rw-r--r--ext/oci8/tests/field_funcs_old.phpt6
-rw-r--r--ext/oci8/tests/lob_040.phpt1041
-rw-r--r--ext/oci8/tests/lob_null.phpt265
-rw-r--r--ext/oci8/tests/oci8safemode.phpt21
-rw-r--r--ext/oci8/tests/parse_error.phpt142
-rw-r--r--ext/oci8/tests/password_2.phpt94
20 files changed, 2319 insertions, 158 deletions
diff --git a/ext/oci8/README b/ext/oci8/README
index b9df41db3..c47b1d750 100644
--- a/ext/oci8/README
+++ b/ext/oci8/README
@@ -5,20 +5,20 @@ Installing OCI8
2. Installing as shared extension.
3. Installing as statically compiled extension.
4. Installing from PECL.
-
+5. Testing OCI8
1. Common requirements
----------------------
-In case if you use Oracle Instant Client, you don't have to set ORACLE_HOME and
-most of the other environment variables to build PHP with OCI8 support.
+In case if you use Oracle Instant Client, you don't have to set ORACLE_HOME and
+most of the other environment variables to build PHP with OCI8 support.
The only variables you may have to set are:
LD_LIBRARY_PATH - it must include Instant Client libraries dir
-NLS_LANG - in case if you want to change the default encoding used during
+NLS_LANG - in case if you want to change the default encoding used during
interaction with Oracle servers
-If you use common Oracle Client installation that comes along with the Oracle
-server installation, you MUST set at least ORACLE_HOME environment variable
-and make it visible for your web-server BEFORE it starts. Most appropriate
+If you use common Oracle Client installation that comes along with the Oracle
+server installation, you MUST set at least ORACLE_HOME environment variable
+and make it visible for your web-server BEFORE it starts. Most appropriate
places to add ORACLE_HOME definition are:
- /etc/profile
- /etc/profile.local
@@ -27,21 +27,21 @@ and others.
2. Installing as shared extension
---------------------------------
-To install OCI8 as shared extension (i.e. the one you should put into
+To install OCI8 as shared extension (i.e. the one you should put into
your php.ini) use the following configure lines to configure PHP:
a) if you use common Oracle Client installation:
./configure --with-oci8=shared,$ORACLE_HOME
b) with Oracle Instant Client:
./configure --with-oci8=shared,instantclient,/path/to/instant/client/lib
-If you use rpm-based installation of Oracle Instant Client, your configure
+If you use rpm-based installation of Oracle Instant Client, your configure
line will look like this:
./configure --with-oci8=shared,instantclient,/usr/lib/oracle/<OIC version>/client/lib
-Follow the usual building procedure after that and you'll get OCI8 shared
+Follow the usual building procedure after that and you'll get OCI8 shared
extension (i.e. oci8.so). Add it into the php.ini file like this:
extension=oci8.so
-and don't forget to specify the right extension_dir for PHP to be able
+and don't forget to specify the right extension_dir for PHP to be able
to find shared extensions correctly.
3. Installing as statically compiled extension
@@ -53,9 +53,84 @@ a) with common Oracle Client installation
b) with Oracle Instant Client
./configure --with-oci8=instantclient,/path/to/instant/client/lib
-After successful compile, you don't have to add oci8.so to the php.ini, the module will
+After successful compile, you don't have to add oci8.so to the php.ini, the module will
be usable without any additional actions.
4. Installing from PECL
-----------------------
TBD
+
+5. Testing OCI8
+---------------
+
+OCI8 tests are in ext/oci8/tests. When OCI8 tests are run this
+directory will contain logs of any failures.
+
+5.1. Running OCI8 tests on Linux
+
+5.1.1. Edit ext/oci8/tests/details.inc
+
+ Set the username, password and connection string for the database.
+ Most tests have been developed using the SYSTEM account: some tests
+ might fail unless the user has permissions to create necessary
+ tables, views, procedures etc.
+
+ If the database is on the same machine as PHP, set
+ $oracle_on_localhost to TRUE.
+
+ An alternative to editing details.inc is the set the environment
+ variables
+
+ PHP_OCI8_TEST_USER
+ PHP_OCI8_TEST_PASS
+ PHP_OCI8_TEST_DB
+ PHP_OCI8_TEST_DB_ON_LOCALHOST
+
+ for example:
+
+ $ export PHP_OCI8_TEST_USER=system
+ $ export PHP_OCI8_TEST_PASS=oracle
+ $ export PHP_OCI8_TEST_DB=localhost/XE
+ $ export PHP_OCI8_TEST_DB_ON_LOCALHOST=TRUE
+
+5.1.2. Set any necessary environment variables for the Oracle
+ database. With Oracle 10g XE do:
+
+ $ . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
+
+ For other versions of the Oracle database do:
+
+ $ . /usr/local/bin/oraenv
+
+5.1.3. Check your php.ini has E in the variables_order parameter, for
+ example:
+
+ variables_order = "EGPCS"
+
+5.1.4. Run the tests:
+
+ $ cd <your php src directory>
+ $ make test TESTS=ext/oci8
+
+5.2. The tests execute rapidly. On fast machines with a local
+ database configured for light load (e.g. Oracle 10g XE) you might
+ see random tests fail with ORA-12516 or ORA-12520 errors. To
+ prevent this, increase the database PROCESSES parameter using the
+ following steps.
+
+5.2.1. Connect as the oracle software owner:
+
+ $ su - oracle
+
+5.2.2. Set the necessary environment variables as in 5.1.2.
+
+5.2.3. Start the SQL*Plus command line tool and increase PROCESSES
+
+ $ sqlplus / as sysdba
+ SQL> alter system set processes=100 scope=spfile
+
+5.2.4. Restart the database:
+
+ SQL> startup force
+
+5.2.5. Rerun the tests
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4
index ef941111e..fda720148 100644
--- a/ext/oci8/config.m4
+++ b/ext/oci8/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.55.2.3.2.6 2007/05/04 11:30:37 tony2001 Exp $
+dnl $Id: config.m4,v 1.55.2.3.2.11 2007/08/14 12:15:04 tony2001 Exp $
dnl
if test -z "$SED"; then
@@ -36,11 +36,11 @@ AC_DEFUN([AC_OCI8_CHECK_LIB_DIR],[
fi
AC_MSG_CHECKING([OCI8 libraries dir])
- if test -d "$OCI8_DIR/lib" -a ! -d "$OCI8_DIR/lib32"; then
- OCI8_LIB_DIR=lib
- elif ! test -d "$OCI8_DIR/lib" -a -d "$OCI8_DIR/lib32"; then
- OCI8_LIB_DIR=lib32
- elif test -d "$OCI8_DIR/lib" -a -d "$OCI8_DIR/lib32"; then
+ if test -d "$OCI8_DIR/lib" && test ! -d "$OCI8_DIR/lib32"; then
+ OCI8_LIB_DIR=lib
+ elif test ! -d "$OCI8_DIR/lib" && test -d "$OCI8_DIR/lib32"; then
+ OCI8_LIB_DIR=lib32
+ elif test -d "$OCI8_DIR/lib" && test -d "$OCI8_DIR/lib32"; then
OCI8_LIB_DIR=$TMP_OCI8_LIB_DIR
else
AC_MSG_ERROR([Oracle (OCI8) required libraries not found])
@@ -50,7 +50,16 @@ AC_DEFUN([AC_OCI8_CHECK_LIB_DIR],[
AC_DEFUN([AC_OCI8IC_VERSION],[
AC_MSG_CHECKING([Oracle Instant Client version])
- if test -f $PHP_OCI8_INSTANT_CLIENT/libnnz10.$SHLIB_SUFFIX_NAME; then
+ if test -f $PHP_OCI8_INSTANT_CLIENT/libnnz11.$SHLIB_SUFFIX_NAME; then
+ if test -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then
+ if test ! -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME; then
+ AC_MSG_ERROR([Link from $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME to libclntsh.$SHLIB_SUFFIX_NAME.11.1 not found])
+ fi
+ OCI8_VERSION=11.1
+ else
+ AC_MSG_ERROR([Oracle Instant Client library version not supported])
+ fi
+ elif test -f $PHP_OCI8_INSTANT_CLIENT/libnnz10.$SHLIB_SUFFIX_NAME; then
if test -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
if test ! -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME; then
AC_MSG_ERROR([Link from $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME to libclntsh.$SHLIB_SUFFIX_NAME.10.1 not found])
@@ -71,6 +80,8 @@ AC_DEFUN([AC_OCI8_VERSION],[
if test -s "$OCI8_DIR/orainst/unix.rgs"; then
OCI8_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | $PHP_OCI8_SED 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
test -z "$OCI8_VERSION" && OCI8_VERSION=7.3
+ elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then
+ OCI8_VERSION=11.1
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
OCI8_VERSION=10.1
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
@@ -96,11 +107,11 @@ dnl --with-oci8=shared,instantclient,/path/to/client/dir/lib
dnl or
dnl --with-oci8=shared,/path/to/oracle/home
PHP_ARG_WITH(oci8, for Oracle (OCI8) support,
-[ --with-oci8[=DIR] Include Oracle (OCI8) support.
- The default DIR is ORACLE_HOME.
- Use --with-oci8=instantclient,/path/to/oic/lib
- to use an Oracle Instant Client installation])
+[ --with-oci8[=DIR] Include Oracle (OCI8) support. DIR defaults to \$ORACLE_HOME.
+ Use --with-oci8=instantclient,/path/to/oic/lib
+ for an Oracle Instant Client installation])
+if test "$PHP_OCI8" != "no"; then
AC_MSG_CHECKING([PHP version])
tmp_version=$PHP_VERSION
@@ -128,22 +139,28 @@ PHP_ARG_WITH(oci8, for Oracle (OCI8) support,
else
AC_MSG_RESULT([$php_version, ok])
fi
-
+fi
PHP_OCI8_INSTANT_CLIENT="no"
if test "`echo $PHP_OCI8 | cut -d, -f2`" = "instantclient"; then
- PHP_OCI8_INSTANT_CLIENT="`echo $PHP_OCI8 | cut -d, -f3`"
+ PHP_OCI8_INSTANT_CLIENT="`echo $PHP_OCI8 | cut -d, -f3`"
PHP_OCI8="`echo $PHP_OCI8 | cut -d, -f1,4`"
- if test "$PHP_OCI8_INSTANT_CLIENT" = ""; then
- PHP_OCI8_INSTANT_CLIENT="yes"
- fi
+ if test "$PHP_OCI8_INSTANT_CLIENT" = ""; then
+ PHP_OCI8_INSTANT_CLIENT="yes"
+ fi
+ if test -z "$PHP_OCI8"; then
+ PHP_OCI8=yes
+ fi
elif test "`echo $PHP_OCI8 | cut -d, -f1`" = "instantclient"; then
- PHP_OCI8_INSTANT_CLIENT="`echo $PHP_OCI8 | cut -d, -f2`"
+ PHP_OCI8_INSTANT_CLIENT="`echo $PHP_OCI8 | cut -d, -f2`"
PHP_OCI8="`echo $PHP_OCI8 | cut -d, -f3,4`"
- if test "$PHP_OCI8_INSTANT_CLIENT" = ""; then
- PHP_OCI8_INSTANT_CLIENT="yes"
- fi
+ if test "$PHP_OCI8_INSTANT_CLIENT" = ""; then
+ PHP_OCI8_INSTANT_CLIENT="yes"
+ fi
+ if test -z "$PHP_OCI8"; then
+ PHP_OCI8=yes
+ fi
fi
if test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
@@ -216,7 +233,7 @@ if test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
])
- PHP_CHECK_LIBRARY(clntsh, OCIStmtPrepare2,
+ PHP_CHECK_LIBRARY(clntsh, OCIStmtPrepare2,
[
AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ])
], [], [
@@ -271,7 +288,7 @@ if test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
;;
- 10.1)
+ 11.1|10.1)
PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD)
AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])
@@ -376,7 +393,7 @@ dnl Header directory for manual installation
AC_OCI8IC_VERSION($PHP_OCI8_INSTANT_CLIENT)
case $OCI8_VERSION in
- 10.1)
+ 11.1|10.1)
PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
PHP_ADD_LIBPATH($PHP_OCI8_INSTANT_CLIENT, OCI8_SHARED_LIBADD)
;;
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index d34ecf7cd..e913e16f9 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -26,7 +26,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8.c,v 1.269.2.16.2.32 2007/02/24 02:17:25 helly Exp $ */
+/* $Id: oci8.c,v 1.269.2.16.2.37 2007/08/06 20:32:54 sixd Exp $ */
/* TODO
*
* file://localhost/www/docs/oci10/ociaahan.htm#423823 - implement lob_empty() with OCI_ATTR_LOBEMPTY
@@ -433,7 +433,7 @@ oci_error:
OCIErrorGet(OCI_G(env), (ub4)1, NULL, &error_code, tmp_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ERROR);
if (error_code) {
- int tmp_buf_len = strlen(tmp_buf);
+ int tmp_buf_len = strlen((char *)tmp_buf);
if (tmp_buf_len > 0 && tmp_buf[tmp_buf_len - 1] == '\n') {
tmp_buf[tmp_buf_len - 1] = '\0';
@@ -674,7 +674,7 @@ PHP_MINFO_FUNCTION(oci)
php_info_print_table_start();
php_info_print_table_row(2, "OCI8 Support", "enabled");
php_info_print_table_row(2, "Version", "1.2.3");
- php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.32 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.37 $");
snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent));
php_info_print_table_row(2, "Active Persistent Connections", buf);
@@ -922,14 +922,14 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC)
PHP_OCI_CALL(OCIErrorGet, (error_handle, (ub4)1, NULL, &error_code, tmp_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ERROR));
if (error_code) {
- int tmp_buf_len = strlen(tmp_buf);
+ int tmp_buf_len = strlen((char *)tmp_buf);
if (tmp_buf_len && tmp_buf[tmp_buf_len - 1] == '\n') {
tmp_buf[tmp_buf_len - 1] = '\0';
}
if (tmp_buf_len && error_buf) {
*error_buf = NULL;
- *error_buf = estrndup(tmp_buf, tmp_buf_len);
+ *error_buf = (text *)estrndup((char *)tmp_buf, tmp_buf_len);
}
}
return error_code;
@@ -1012,6 +1012,16 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
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;
}
+ /* Disable privileged connections in Safe Mode (N.b. safe mode has been removed in PHP 6 anyway) */
+ if (PG(safe_mode)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Privileged connect is disabled in Safe Mode");
+ return NULL;
+ }
+ /* Increase security by not caching privileged
+ * oci_pconnect() connections. The connection becomes
+ * equivalent to oci_connect() or oci_new_connect().
+ */
+ persistent = 0;
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid session mode specified (%ld)", session_mode);
@@ -1041,7 +1051,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
#if HAVE_OCI_ENV_NLS_CREATE
if (charset && *charset) {
- PHP_OCI_CALL_RETURN(charsetid, OCINlsCharSetNameToId, (OCI_G(env), charset));
+ PHP_OCI_CALL_RETURN(charsetid, OCINlsCharSetNameToId, (OCI_G(env), (CONST oratext *)charset));
if (!charsetid) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid character set name: %s", charset);
} else {
@@ -1193,6 +1203,9 @@ open:
/* -1 means "Off" */
connection->next_ping = 0;
}
+
+ /* mark password as unchanged by PHP during the duration of the database session */
+ connection->passwd_changed = 0;
smart_str_free_ex(&hashed_details, 0);
@@ -1374,7 +1387,7 @@ open:
}
#if HAVE_OCI_STMT_PREPARE2
- if (connection->is_persistent) {
+ {
ub4 statement_cache_size = (OCI_G(statement_cache_size) > 0) ? OCI_G(statement_cache_size) : 0;
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err)));
@@ -1389,7 +1402,7 @@ open:
/* mark it as open */
connection->is_open = 1;
-
+
/* add to the appropriate hash */
if (connection->is_persistent) {
new_le.ptr = connection;
@@ -1561,6 +1574,7 @@ int php_oci_password_change(php_oci_connection *connection, char *user, int user
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->passwd_changed = 1;
return 0;
} /* }}} */
@@ -1780,7 +1794,7 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC)
if (connection->used_this_request) {
if ((PG(connection_status) & PHP_CONNECTION_TIMEOUT) || OCI_G(in_call)) {
- return 1;
+ return ZEND_HASH_APPLY_REMOVE;
}
if (connection->descriptors) {
@@ -1793,6 +1807,18 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC)
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);
}
@@ -1805,14 +1831,15 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC)
}
connection->used_this_request = 0;
+
} else if (OCI_G(persistent_timeout) != -1) {
if (connection->idle_expiry < timestamp) {
/* connection has timed out */
- return 1;
+ return ZEND_HASH_APPLY_REMOVE;
}
}
}
- return 0;
+ return ZEND_HASH_APPLY_KEEP;
} /* }}} */
#ifdef ZTS
@@ -1832,3 +1859,12 @@ static int php_oci_list_helper(zend_rsrc_list_entry *le, void *le_type TSRMLS_DC
#endif
#endif /* HAVE_OCI8 */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c
index 713861e97..3e7b30b56 100644
--- a/ext/oci8/oci8_collection.c
+++ b/ext/oci8/oci8_collection.c
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_collection.c,v 1.5.2.3.2.5 2007/01/01 09:36:03 sebastian Exp $ */
+/* $Id: oci8_collection.c,v 1.5.2.3.2.7 2007/07/31 19:21:08 tony2001 Exp $ */
@@ -55,7 +55,8 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
collection->connection = connection;
collection->collection = NULL;
-
+ zend_list_addref(collection->connection->rsrc_id);
+
/* get type handle by name */
PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByName,
(
@@ -296,7 +297,7 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i
php_oci_connection *connection = collection->connection;
/* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, date, date_len, NULL, 0, NULL, 0, &oci_date));
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date));
if (connection->errcode != OCI_SUCCESS) {
/* failed to convert string to date */
@@ -366,7 +367,7 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme
OCIString *ocistr = (OCIString *)0;
php_oci_connection *connection = collection->connection;
- PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, element, element_len, &ocistr));
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
@@ -439,8 +440,8 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
dvoid *element;
OCIInd *element_index;
boolean exists;
- char buff[1024];
- int buff_len = 1024;
+ oratext buff[1024];
+ ub4 buff_len = 1024;
MAKE_STD_ZVAL(*result_element);
ZVAL_NULL(*result_element);
@@ -484,7 +485,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
return 1;
}
- ZVAL_STRINGL(*result_element, buff, buff_len, 1);
+ ZVAL_STRINGL(*result_element, (char *)buff, buff_len, 1);
Z_STRVAL_P(*result_element)[buff_len] = '\0';
return 0;
@@ -498,7 +499,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
PHP_OCI_CALL_RETURN(str, OCIStringPtr, (connection->env, oci_string));
if (str) {
- ZVAL_STRING(*result_element, str, 1);
+ ZVAL_STRING(*result_element, (char *)str, 1);
}
return 0;
}
@@ -567,7 +568,7 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind
php_oci_connection *connection = collection->connection;
/* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, date, date_len, NULL, 0, NULL, 0, &oci_date));
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date));
if (connection->errcode != OCI_SUCCESS) {
/* failed to convert string to date */
@@ -639,7 +640,7 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i
OCIString *ocistr = (OCIString *)0;
php_oci_connection *connection = collection->connection;
- PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, element, element_len, &ocistr));
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
@@ -741,3 +742,12 @@ void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC)
} /* }}} */
#endif /* HAVE_OCI8 */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index 8a5640e08..c6a78a24f 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_interface.c,v 1.8.2.7.2.9 2007/01/11 12:01:08 tony2001 Exp $ */
+/* $Id: oci8_interface.c,v 1.8.2.7.2.13 2007/08/02 19:04:37 sixd Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1183,7 +1183,22 @@ PHP_FUNCTION(oci_field_type)
#endif
#ifdef SQLT_TIMESTAMP_TZ
case SQLT_TIMESTAMP_TZ:
- RETVAL_STRING("TIMESTAMP_TZ",1);
+ RETVAL_STRING("TIMESTAMP WITH TIMEZONE",1);
+ break;
+#endif
+#ifdef SQLT_TIMESTAMP_LTZ
+ case SQLT_TIMESTAMP_LTZ:
+ RETVAL_STRING("TIMESTAMP WITH LOCAL TIMEZONE",1);
+ break;
+#endif
+#ifdef SQLT_INTERVAL_YM
+ case SQLT_INTERVAL_YM:
+ RETVAL_STRING("INTERVAL YEAR TO MONTH",1);
+ break;
+#endif
+#ifdef SQLT_INTERVAL_DS
+ case SQLT_INTERVAL_DS:
+ RETVAL_STRING("INTERVAL DAY TO SECOND",1);
break;
#endif
case SQLT_DAT:
@@ -1583,19 +1598,28 @@ PHP_FUNCTION(oci_error)
RETURN_FALSE;
}
#endif
- } else {
- connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_connection);
-
- if (connection) {
- errh = connection->err;
- error = connection->errcode;
- }
+ goto go_out;
+ }
+
+ connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_connection);
+ if (connection) {
+ errh = connection->err;
+ error = connection->errcode;
+ goto go_out;
+ }
+
+ connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_pconnection);
+ if (connection) {
+ errh = connection->err;
+ error = connection->errcode;
+ goto go_out;
}
} else {
errh = OCI_G(err);
error = OCI_G(errcode);
}
+go_out:
if (error == OCI_SUCCESS) { /* no error set in the handle */
RETURN_FALSE;
}
@@ -1715,7 +1739,7 @@ PHP_FUNCTION(oci_password_change)
RETURN_FALSE;
}
- if (php_oci_password_change(connection, user, user_len, pass_old, pass_old_len, pass_new, pass_new_len TSRMLS_CC)) {
+ if (php_oci_password_change(connection, (char *)user, user_len, (char *)pass_old, pass_old_len, (char *)pass_new, pass_new_len TSRMLS_CC)) {
RETURN_FALSE;
}
RETURN_TRUE;
@@ -1734,7 +1758,7 @@ PHP_FUNCTION(oci_password_change)
RETURN_FALSE;
}
- connection = php_oci_do_connect_ex(user, user_len, pass_old, pass_old_len, pass_new, pass_new_len, dbname, dbname_len, NULL, OCI_DEFAULT, 0, 0 TSRMLS_CC);
+ connection = php_oci_do_connect_ex((char *)user, user_len, (char *)pass_old, pass_old_len, (char *)pass_new, pass_new_len, (char *)dbname, dbname_len, NULL, OCI_DEFAULT, 0, 0 TSRMLS_CC);
if (!connection) {
RETURN_FALSE;
}
@@ -2169,3 +2193,12 @@ PHP_FUNCTION(oci_new_collection)
#endif
#endif /* HAVE_OCI8 */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index e3aa23127..066ff0a3b 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_lob.c,v 1.7.2.6.2.11 2007/03/29 09:33:03 tony2001 Exp $ */
+/* $Id: oci8_lob.c,v 1.7.2.6.2.14 2007/07/31 19:21:08 tony2001 Exp $ */
@@ -69,6 +69,8 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ
descriptor = ecalloc(1, sizeof(php_oci_descriptor));
descriptor->type = type;
+ descriptor->connection = connection;
+ zend_list_addref(descriptor->connection->rsrc_id);
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0));
@@ -79,8 +81,6 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ
return NULL;
}
- descriptor->connection = connection;
-
PHP_OCI_REGISTER_RESOURCE(descriptor, le_descriptor);
descriptor->lob_current_position = 0;
@@ -672,7 +672,8 @@ void php_oci_lob_free (php_oci_descriptor *descriptor TSRMLS_DC)
Import LOB contents from the given file */
int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC)
{
- int fp, loblen;
+ int fp;
+ ub4 loblen;
OCILobLocator *lob = (OCILobLocator *)descriptor->descriptor;
php_oci_connection *connection = descriptor->connection;
char buf[8192];
@@ -695,9 +696,9 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC
connection->err,
lob,
&loblen,
- (ub4) offset,
+ offset,
(dvoid *) &buf,
- (ub4) loblen,
+ loblen,
OCI_ONE_PIECE,
(dvoid *)0,
(OCICallbackLobWrite) 0,
@@ -859,8 +860,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data,
break;
}
- if (!data || data_len <= 0) {
- /* nothing to write, silently fail */
+ if (data_len < 0) {
return 1;
}
@@ -895,3 +895,12 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data,
} /* }}} */
#endif /* HAVE_OCI8 */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index 0fabd881a..52e0c3546 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_statement.c,v 1.7.2.14.2.23 2007/03/01 22:27:44 tony2001 Exp $ */
+/* $Id: oci8_statement.c,v 1.7.2.14.2.28 2007/08/02 19:04:37 sixd Exp $ */
#ifdef HAVE_CONFIG_H
@@ -82,7 +82,7 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
#if HAVE_OCI_STMT_PREPARE2
- PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_STRLS_CACHE_DELETE));
+ PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT));
PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR));
#else
PHP_OCI_CALL(OCIHandleFree,(statement->stmt, OCI_HTYPE_STMT));
@@ -107,6 +107,7 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha
statement->connection = connection;
statement->has_data = 0;
statement->nested = 0;
+ zend_list_addref(statement->connection->rsrc_id);
if (OCI_G(default_prefetch) > 0) {
php_oci_statement_set_prefetch(statement, OCI_G(default_prefetch) TSRMLS_CC);
@@ -629,6 +630,15 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
#ifdef SQLT_TIMESTAMP_TZ
|| (outcol->data_type == SQLT_TIMESTAMP_TZ)
#endif
+#ifdef SQLT_TIMESTAMP_LTZ
+ || (outcol->data_type == SQLT_TIMESTAMP_LTZ)
+#endif
+#ifdef SQLT_INTERVAL_YM
+ || (outcol->data_type == SQLT_INTERVAL_YM)
+#endif
+#ifdef SQLT_INTERVAL_DS
+ || (outcol->data_type == SQLT_INTERVAL_DS)
+#endif
) {
outcol->storage_size4 = 512; /* XXX this should fit "most" NLS date-formats and Numbers */
#if defined(SQLT_IBFLOAT) && defined(SQLT_IBDOUBLE)
@@ -733,7 +743,7 @@ void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC)
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, OCI_STRLS_CACHE_DELETE));
+ PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT));
} else {
PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT));
}
@@ -838,8 +848,8 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
break;
case SQLT_ODT:
for (i = 0; i < bind->array.current_length; i++) {
- char buff[1024];
- int buff_len = 1024;
+ oratext buff[1024];
+ ub4 buff_len = 1024;
memset((void*)buff,0,sizeof(buff));
@@ -851,7 +861,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
ZVAL_NULL(*entry);
} else {
- ZVAL_STRINGL(*entry, buff, buff_len, 1);
+ ZVAL_STRINGL(*entry, (char *)buff, buff_len, 1);
}
zend_hash_move_forward(hash);
} else {
@@ -860,7 +870,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
add_next_index_null(bind->zval);
} else {
- add_next_index_stringl(bind->zval, buff, buff_len, 1);
+ add_next_index_stringl(bind->zval, (char *)buff, buff_len, 1);
}
}
}
@@ -877,10 +887,10 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
int curr_element_length = bind->array.element_lengths[i];
if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
zval_dtor(*entry);
- ZVAL_STRINGL(*entry, ((text *)bind->array.elements)+i*bind->array.max_length, curr_element_length, 1);
+ ZVAL_STRINGL(*entry, (char *)(((text *)bind->array.elements)+i*bind->array.max_length), curr_element_length, 1);
zend_hash_move_forward(hash);
} else {
- add_next_index_stringl(bind->zval, ((text *)bind->array.elements)+i*bind->array.max_length, curr_element_length, 1);
+ add_next_index_stringl(bind->zval, (char *)(((text *)bind->array.elements)+i*bind->array.max_length), curr_element_length, 1);
}
}
break;
@@ -1553,7 +1563,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, p
if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
convert_to_string_ex(entry);
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date));
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date));
if (connection->errcode != OCI_SUCCESS) {
/* failed to convert string to date */
@@ -1567,7 +1577,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, p
((OCIDate *)bind->array.elements)[i] = oci_date;
zend_hash_move_forward(hash);
} else {
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, "01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date));
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)"01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date));
if (connection->errcode != OCI_SUCCESS) {
/* failed to convert string to date */
@@ -1587,3 +1597,12 @@ php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, p
} /* }}} */
#endif /* HAVE_OCI8 */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/oci8/package2.xml b/ext/oci8/package2.xml
index 30225cf31..523023d6e 100644
--- a/ext/oci8/package2.xml
+++ b/ext/oci8/package2.xml
@@ -27,22 +27,29 @@ the Oracle Call Interface (OCI8).
<email>andi@zend.com</email>
<active>yes</active>
</lead>
- <date>2007-01-25</date>
- <time>19:52:26</time>
+ <date>2007-08-08</date>
+ <time>19:00:00</time>
<version>
- <release>1.2.3</release>
- <api>1.2.3</api>
+ <release>1.2.4</release>
+ <api>1.2.4</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP</license>
- <notes>Fixed possible segfault in ZTS mode when statements containing sub-statements are destroyed in wrong order.
-Fixed bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name()).
-Fixed bug #39988 (type argument of oci_define_by_name() is ignored).
-Fixed bug #39732 (oci_bind_array_by_name doesn&apos;t work on Solaris 64bit).
-Fixed PECL bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column).
+ <notes>Fixed PECL bug #10194 (crash in Oracle client when memory limit reached in the callback).
+Fixed bug #42173 (oci_field_type fixes for INTERVAL and TIMESTAMP types).
+Fixed bug #42134 (oci_error() returns false after oci_new_collection() fails).
+Fixed bug #41917 (oci_field_precision and oci_field_scale datatypes fixed).
+Fixed bug #41711 (Null temporary lobs not supported).
+Fixed bug #41594 (Statement cache is flushed too frequently).
+Fixed bug #40415 (oci_fetch_all and nested cursors, allocate descriptors dynamically)
+Fixed segfault on rebinding and re-executing a statement with LOBs.
+Fixed compile failure in ZTS mode when collections support is missing.
+Allowed statement cache size to be set for non-persistent connections.
+Improved oci_password_change() to close persistent connections on shutdown (to update hashed connection details).
+Changed oci_pconnect() to behave like oci_connect() when SYSDBA and SYSOPER privileges are used.
Various minor improvements.
</notes>
<contents>
@@ -62,23 +69,23 @@ Various minor improvements.
<file name="array_bind_012.phpt" role="test" />
<file name="array_bind_013.phpt" role="test" />
<file name="array_bind_014.phpt" role="test" />
- <file name="array_bind_date.phpt" role="test" />
<file name="array_bind_date1.phpt" role="test" />
- <file name="array_bind_float.phpt" role="test" />
+ <file name="array_bind_date.phpt" role="test" />
<file name="array_bind_float1.phpt" role="test" />
- <file name="array_bind_int.phpt" role="test" />
+ <file name="array_bind_float.phpt" role="test" />
<file name="array_bind_int1.phpt" role="test" />
- <file name="array_bind_str.phpt" role="test" />
+ <file name="array_bind_int.phpt" role="test" />
<file name="array_bind_str1.phpt" role="test" />
+ <file name="array_bind_str.phpt" role="test" />
<file name="bind_empty.phpt" role="test" />
<file name="bind_long.phpt" role="test" />
<file name="bind_long_raw.phpt" role="test" />
<file name="bind_raw.phpt" role="test" />
<file name="bug26133.phpt" role="test" />
- <file name="bug27303.phpt" role="test" />
<file name="bug27303_2.phpt" role="test" />
<file name="bug27303_3.phpt" role="test" />
<file name="bug27303_4.phpt" role="test" />
+ <file name="bug27303.phpt" role="test" />
<file name="bug32325.phpt" role="test" />
<file name="bug35973.phpt" role="test" />
<file name="bug36010.phpt" role="test" />
@@ -87,89 +94,99 @@ Various minor improvements.
<file name="bug38161.phpt" role="test" />
<file name="bug38173.phpt" role="test" />
<file name="bug40078.phpt" role="test" />
+ <file name="bug40415.phpt" role="test" />
+ <file name="bug42134.phpt" role="test" />
+ <file name="bug42173.phpt" role="test" />
<file name="close.phpt" role="test" />
<file name="coll_001.phpt" role="test" />
- <file name="coll_002.phpt" role="test" />
<file name="coll_002_func.phpt" role="test" />
- <file name="coll_003.phpt" role="test" />
+ <file name="coll_002.phpt" role="test" />
<file name="coll_003_func.phpt" role="test" />
- <file name="coll_004.phpt" role="test" />
+ <file name="coll_003.phpt" role="test" />
<file name="coll_004_func.phpt" role="test" />
+ <file name="coll_004.phpt" role="test" />
<file name="coll_005.phpt" role="test" />
- <file name="coll_006.phpt" role="test" />
<file name="coll_006_func.phpt" role="test" />
+ <file name="coll_006.phpt" role="test" />
<file name="coll_007.phpt" role="test" />
<file name="coll_008.phpt" role="test" />
- <file name="coll_009.phpt" role="test" />
<file name="coll_009_func.phpt" role="test" />
- <file name="coll_010.phpt" role="test" />
+ <file name="coll_009.phpt" role="test" />
<file name="coll_010_func.phpt" role="test" />
- <file name="coll_011.phpt" role="test" />
+ <file name="coll_010.phpt" role="test" />
<file name="coll_011_func.phpt" role="test" />
- <file name="coll_012.phpt" role="test" />
+ <file name="coll_011.phpt" role="test" />
<file name="coll_012_func.phpt" role="test" />
- <file name="coll_013.phpt" role="test" />
+ <file name="coll_012.phpt" role="test" />
<file name="coll_013_func.phpt" role="test" />
- <file name="coll_014.phpt" role="test" />
+ <file name="coll_013.phpt" role="test" />
<file name="coll_014_func.phpt" role="test" />
- <file name="coll_015.phpt" role="test" />
+ <file name="coll_014.phpt" role="test" />
<file name="coll_015_func.phpt" role="test" />
- <file name="coll_016.phpt" role="test" />
+ <file name="coll_015.phpt" role="test" />
<file name="coll_016_func.phpt" role="test" />
- <file name="coll_017.phpt" role="test" />
+ <file name="coll_016.phpt" role="test" />
<file name="coll_017_func.phpt" role="test" />
+ <file name="coll_017.phpt" role="test" />
<file name="coll_018.phpt" role="test" />
<file name="coll_019.phpt" role="test" />
- <file name="commit.phpt" role="test" />
<file name="commit_old.phpt" role="test" />
- <file name="connect.inc" role="test" />
- <file name="connect.phpt" role="test" />
- <file name="connect_1.phpt" role="test" />
+ <file name="commit.phpt" role="test" />
<file name="connect_1_old.phpt" role="test" />
+ <file name="connect_1.phpt" role="test" />
+ <file name="connect.inc" role="test" />
<file name="connect_old.phpt" role="test" />
- <file name="connect_without_oracle_home.phpt" role="test" />
- <file name="connect_without_oracle_home_old.phpt" role="test" />
+ <file name="connect.phpt" role="test" />
+ <file name="connect_with_charset_001.diff" role="test" />
+ <file name="connect_with_charset_001.exp" role="test" />
+ <file name="connect_with_charset_001.log" role="test" />
+ <file name="connect_with_charset_001.out" role="test" />
+ <file name="connect_with_charset_001.php" role="test" />
<file name="connect_with_charset_001.phpt" role="test" />
+ <file name="connect_without_oracle_home_old.phpt" role="test" />
+ <file name="connect_without_oracle_home.phpt" role="test" />
<file name="create_table.inc" role="test" />
<file name="create_type.inc" role="test" />
- <file name="cursors.phpt" role="test" />
- <file name="cursors_old.phpt" role="test" />
- <file name="cursor_bind.phpt" role="test" />
<file name="cursor_bind_err.phpt" role="test" />
+ <file name="cursor_bind.phpt" role="test" />
+ <file name="cursors_old.phpt" role="test" />
+ <file name="cursors.phpt" role="test" />
<file name="debug.phpt" role="test" />
- <file name="default_prefetch.phpt" role="test" />
<file name="default_prefetch1.phpt" role="test" />
<file name="default_prefetch2.phpt" role="test" />
- <file name="define.phpt" role="test" />
+ <file name="default_prefetch.phpt" role="test" />
<file name="define1.phpt" role="test" />
<file name="define2.phpt" role="test" />
<file name="define3.phpt" role="test" />
<file name="define4.phpt" role="test" />
<file name="define5.phpt" role="test" />
<file name="define_old.phpt" role="test" />
+ <file name="define.phpt" role="test" />
<file name="descriptors.phpt" role="test" />
<file name="details.inc" role="test" />
<file name="drop_table.inc" role="test" />
<file name="drop_type.inc" role="test" />
- <file name="error.phpt" role="test" />
<file name="error1.phpt" role="test" />
<file name="error2.phpt" role="test" />
<file name="error_old.phpt" role="test" />
- <file name="execute_mode.phpt" role="test" />
+ <file name="error.phpt" role="test" />
<file name="exec_fetch.phpt" role="test" />
- <file name="fetch.phpt" role="test" />
- <file name="fetch_all.phpt" role="test" />
+ <file name="execute_mode.phpt" role="test" />
<file name="fetch_all2.phpt" role="test" />
+ <file name="fetch_all3.phpt" role="test" />
+ <file name="fetch_all.phpt" role="test" />
<file name="fetch_array.phpt" role="test" />
<file name="fetch_assoc.phpt" role="test" />
- <file name="fetch_into.phpt" role="test" />
<file name="fetch_into1.phpt" role="test" />
<file name="fetch_into2.phpt" role="test" />
+ <file name="fetch_into.phpt" role="test" />
<file name="fetch_object.phpt" role="test" />
+ <file name="fetch.phpt" role="test" />
<file name="fetch_row.phpt" role="test" />
- <file name="field_funcs.phpt" role="test" />
<file name="field_funcs1.phpt" role="test" />
+ <file name="field_funcs2.phpt" role="test" />
<file name="field_funcs_old.phpt" role="test" />
+ <file name="field_funcs.phpt" role="test" />
<file name="function_aliases.phpt" role="test" />
<file name="lob_001.phpt" role="test" />
<file name="lob_002.phpt" role="test" />
@@ -180,6 +197,7 @@ Various minor improvements.
<file name="lob_007.phpt" role="test" />
<file name="lob_008.phpt" role="test" />
<file name="lob_009.phpt" role="test" />
+ <file name="lob_009.txt" role="test" />
<file name="lob_010.phpt" role="test" />
<file name="lob_011.phpt" role="test" />
<file name="lob_012.phpt" role="test" />
@@ -207,28 +225,45 @@ Various minor improvements.
<file name="lob_034.phpt" role="test" />
<file name="lob_035.phpt" role="test" />
<file name="lob_036.phpt" role="test" />
+ <file name="lob_037.phpt" role="test" />
+ <file name="lob_038.phpt" role="test" />
+ <file name="lob_039.diff" role="test" />
+ <file name="lob_039.exp" role="test" />
+ <file name="lob_039.log" role="test" />
+ <file name="lob_039.out" role="test" />
+ <file name="lob_039.php" role="test" />
+ <file name="lob_039.phpt" role="test" />
+ <file name="lob_040.phpt" role="test" />
<file name="lob_aliases.phpt" role="test" />
- <file name="lob_temp.phpt" role="test" />
+ <file name="lob_null.phpt" role="test" />
<file name="lob_temp1.phpt" role="test" />
+ <file name="lob_temp.phpt" role="test" />
<file name="num.phpt" role="test" />
+ <file name="oci8safemode.phpt" role="test" />
<file name="oci_execute_segfault.phpt" role="test" />
- <file name="old_oci_close.phpt" role="test" />
<file name="old_oci_close1.phpt" role="test" />
- <file name="password.phpt" role="test" />
+ <file name="old_oci_close.phpt" role="test" />
+ <file name="parse_error.phpt" role="test" />
+ <file name="password_2.phpt" role="test" />
<file name="password_new.phpt" role="test" />
<file name="password_old.phpt" role="test" />
+ <file name="password.phpt" role="test" />
+ <file name="pecl_bug10194_blob.phpt" role="test" />
+ <file name="pecl_bug10194.phpt" role="test" />
<file name="pecl_bug8816.phpt" role="test" />
<file name="persistent.phpt" role="test" />
- <file name="prefetch.phpt" role="test" />
<file name="prefetch_old.phpt" role="test" />
- <file name="privileged_connect.phpt" role="test" />
+ <file name="prefetch.phpt" role="test" />
<file name="privileged_connect1.phpt" role="test" />
+ <file name="privileged_connect.phpt" role="test" />
<file name="select_null.phpt" role="test" />
<file name="serverversion.phpt" role="test" />
<file name="skipif.inc" role="test" />
<file name="statement_cache.phpt" role="test" />
- <file name="statement_type.phpt" role="test" />
<file name="statement_type_old.phpt" role="test" />
+ <file name="statement_type.phpt" role="test" />
+ <file name="test.gif" role="test" />
+ <file name="test.txt" role="test" />
<file name="uncommitted.phpt" role="test" />
</dir> <!-- //tests -->
<file name="config.m4" role="src" />
@@ -248,7 +283,7 @@ Various minor improvements.
<dependencies>
<required>
<php>
- <min>4.3.10</min>
+ <min>4.3.11</min>
<max>6.0.0</max>
<exclude>6.0.0</exclude>
</php>
@@ -264,6 +299,23 @@ Various minor improvements.
<changelog>
<release>
<version>
+ <release>1.2.3</release>
+ <api>1.2.3</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
+ <date>2007-01-25</date>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>Fixed possible segfault in ZTS mode when statements containing sub-statements are destroyed in wrong order.
+Fixed bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name()).
+Fixed bug #39988 (type argument of oci_define_by_name() is ignored).
+Fixed bug #39732 (oci_bind_array_by_name doesn&apos;t work on Solaris 64bit).
+Fixed PECL bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column).
+Various minor improvements.
+ </notes>
+ <version>
<release>1.2.2</release>
<api>1.2.2</api>
</version>
diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index 664fc4f6e..e849a40c3 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_oci8_int.h,v 1.11.2.6.2.18 2007/03/29 09:33:03 tony2001 Exp $ */
+/* $Id: php_oci8_int.h,v 1.11.2.6.2.21 2007/08/06 20:32:55 sixd Exp $ */
#if HAVE_OCI8
# ifndef PHP_OCI8_INT_H
@@ -112,6 +112,7 @@ typedef struct { /* php_oci_connection {{{ */
unsigned is_persistent:1; /* self-descriptive */
unsigned used_this_request:1; /* helps to determine if we should reset connection's next ping time and check its timeout */
unsigned needs_commit:1; /* helps to determine if we should rollback this connection on close/shutdown */
+ unsigned passwd_changed:1; /* helps determine if a persistent connection hash should be invalidated after a password change */
int rsrc_id; /* resource ID */
time_t idle_expiry; /* time when the connection will be considered as expired */
time_t next_ping; /* time of the next ping */
@@ -215,8 +216,8 @@ typedef struct { /* php_oci_out_column {{{ */
php_oci_define *define; /* define handle */
int piecewise; /* column is fetched piece-by-piece */
ub4 cb_retlen; /* */
- ub2 scale; /* column scale */
- ub2 precision; /* column precision */
+ sb1 scale; /* column scale */
+ sb2 precision; /* column precision */
ub1 charset_form; /* charset form, required for NCLOBs */
ub2 charset_id; /* charset ID */
} php_oci_out_column; /* }}} */
@@ -263,7 +264,6 @@ typedef struct { /* php_oci_out_column {{{ */
#define PHP_OCI_REGISTER_RESOURCE(resource, le_resource) \
do { \
resource->id = ZEND_REGISTER_RESOURCE(NULL, resource, le_resource); \
- zend_list_addref(resource->connection->rsrc_id); \
} while (0)
#define PHP_OCI_ZVAL_TO_CONNECTION(zval, connection) \
diff --git a/ext/oci8/tests/bug42134.phpt b/ext/oci8/tests/bug42134.phpt
new file mode 100644
index 000000000..2b0e3707d
--- /dev/null
+++ b/ext/oci8/tests/bug42134.phpt
@@ -0,0 +1,100 @@
+--TEST--
+Bug #42134 (Collection error for invalid collection name)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/details.inc');
+
+// Test collection creation error for normal connection
+
+if (!empty($dbase)) {
+ $c = oci_connect($user,$password,$dbase);
+}
+else {
+ $c = oci_connect($user,$password);
+}
+
+$collection = oci_new_collection($c, "ABC");
+if (!$collection) {
+ echo "Normal connection: New Collection error\n";
+ $m = oci_error($c);
+ var_dump($m);
+}
+
+// Test collection creation error for new connection
+
+if (!empty($dbase)) {
+ $c = oci_new_connect($user,$password,$dbase);
+}
+else {
+ $c = oci_new_connect($user,$password);
+}
+
+$collection = oci_new_collection($c, "DEF");
+if (!$collection) {
+ echo "New connection: New Collection error\n";
+ $m = oci_error($c);
+ var_dump($m);
+}
+
+// Test collection creation error for persistent connection
+
+if (!empty($dbase)) {
+ $c = oci_pconnect($user,$password,$dbase);
+}
+else {
+ $c = oci_pconnect($user,$password);
+}
+
+$collection = oci_new_collection($c, "GHI");
+if (!$collection) {
+ echo "Persistent connection: New Collection error\n";
+ $m = oci_error($c);
+ var_dump($m);
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Warning: oci_new_collection(): OCI-22303: type ""."ABC" not found in %s on line %d
+Normal connection: New Collection error
+array(4) {
+ ["code"]=>
+ int(22303)
+ ["message"]=>
+ string(34) "OCI-22303: type ""."ABC" not found"
+ ["offset"]=>
+ int(0)
+ ["sqltext"]=>
+ string(0) ""
+}
+
+Warning: oci_new_collection(): OCI-22303: type ""."DEF" not found in %s on line %d
+New connection: New Collection error
+array(4) {
+ ["code"]=>
+ int(22303)
+ ["message"]=>
+ string(34) "OCI-22303: type ""."DEF" not found"
+ ["offset"]=>
+ int(0)
+ ["sqltext"]=>
+ string(0) ""
+}
+
+Warning: oci_new_collection(): OCI-22303: type ""."GHI" not found in %s on line %d
+Persistent connection: New Collection error
+array(4) {
+ ["code"]=>
+ int(22303)
+ ["message"]=>
+ string(34) "OCI-22303: type ""."GHI" not found"
+ ["offset"]=>
+ int(0)
+ ["sqltext"]=>
+ string(0) ""
+}
+Done
diff --git a/ext/oci8/tests/bug42173.phpt b/ext/oci8/tests/bug42173.phpt
new file mode 100644
index 000000000..501ed75cd
--- /dev/null
+++ b/ext/oci8/tests/bug42173.phpt
@@ -0,0 +1,168 @@
+--TEST--
+Bug #42173 (TIMESTAMP and INTERVAL query and field functions)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+$stmts = array(
+
+"drop table ts_test",
+
+"create table ts_test (
+c1 TIMESTAMP,
+c2 TIMESTAMP (5),
+c3 TIMESTAMP WITH TIME ZONE,
+c4 TIMESTAMP (2) WITH TIME ZONE,
+c5 TIMESTAMP WITH LOCAL TIME ZONE,
+c6 INTERVAL YEAR TO MONTH,
+c7 INTERVAL YEAR(2) TO MONTH,
+c8 INTERVAL DAY TO SECOND,
+c9 INTERVAL DAY(2) TO SECOND(3)
+)",
+
+"insert into ts_test values (
+timestamp'1999-01-03 10:00:00.123',
+timestamp'1999-01-04 10:00:00.123456',
+timestamp'1999-01-05 10:00:00.123456+1:0',
+timestamp'1999-01-06 10:00:00.123456-1:0',
+timestamp'1999-01-06 10:00:00.123456-1:0',
+interval'1-2' year to month,
+interval'10-4' year to month,
+interval'1 2:20:20.123' day to second,
+interval'1 2:20:20.12345' day to second)");
+
+foreach ($stmts as $sql) {
+ $s = oci_parse($c, $sql);
+ $r = @oci_execute($s);
+}
+
+$s = oci_parse($c, "select * from ts_test");
+$r = oci_execute($s);
+$row = oci_fetch_array($s, OCI_ASSOC);
+var_dump($row);
+
+foreach ($row as $name => $field) {
+ echo "\nColumn $name\n";
+ var_dump(oci_field_is_null($s, $name));
+ var_dump(oci_field_name($s, $name));
+ var_dump(oci_field_type($s, $name));
+ var_dump(oci_field_type_raw($s, $name));
+ var_dump(oci_field_scale($s, $name));
+ var_dump(oci_field_precision($s, $name));
+ var_dump(oci_field_size($s, $name));
+}
+
+// Cleanup
+
+$s = oci_parse($c, "drop table ts_test");
+$r = @oci_execute($s);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+array(9) {
+ ["C1"]=>
+ string(28) "03-JAN-99 10.00.00.123000 AM"
+ ["C2"]=>
+ string(27) "04-JAN-99 10.00.00.12346 AM"
+ ["C3"]=>
+ string(35) "05-JAN-99 10.00.00.123456 AM +01:00"
+ ["C4"]=>
+ string(31) "06-JAN-99 10.00.00.12 AM -01:00"
+ ["C5"]=>
+ string(28) "%s"
+ ["C6"]=>
+ string(6) "+01-02"
+ ["C7"]=>
+ string(6) "+10-04"
+ ["C8"]=>
+ string(19) "+01 02:20:20.123000"
+ ["C9"]=>
+ string(16) "+01 02:20:20.123"
+}
+
+Column C1
+bool(false)
+string(2) "C1"
+string(9) "TIMESTAMP"
+int(187)
+int(6)
+int(0)
+int(11)
+
+Column C2
+bool(false)
+string(2) "C2"
+string(9) "TIMESTAMP"
+int(187)
+int(5)
+int(0)
+int(11)
+
+Column C3
+bool(false)
+string(2) "C3"
+string(23) "TIMESTAMP WITH TIMEZONE"
+int(188)
+int(6)
+int(0)
+int(13)
+
+Column C4
+bool(false)
+string(2) "C4"
+string(23) "TIMESTAMP WITH TIMEZONE"
+int(188)
+int(2)
+int(0)
+int(13)
+
+Column C5
+bool(false)
+string(2) "C5"
+string(29) "TIMESTAMP WITH LOCAL TIMEZONE"
+int(232)
+int(6)
+int(0)
+int(11)
+
+Column C6
+bool(false)
+string(2) "C6"
+string(22) "INTERVAL YEAR TO MONTH"
+int(189)
+int(0)
+int(2)
+int(5)
+
+Column C7
+bool(false)
+string(2) "C7"
+string(22) "INTERVAL YEAR TO MONTH"
+int(189)
+int(0)
+int(2)
+int(5)
+
+Column C8
+bool(false)
+string(2) "C8"
+string(22) "INTERVAL DAY TO SECOND"
+int(190)
+int(6)
+int(2)
+int(11)
+
+Column C9
+bool(false)
+string(2) "C9"
+string(22) "INTERVAL DAY TO SECOND"
+int(190)
+int(3)
+int(2)
+int(11)
+Done
diff --git a/ext/oci8/tests/details.inc b/ext/oci8/tests/details.inc
index 6cf13ac72..bfd9f309b 100644
--- a/ext/oci8/tests/details.inc
+++ b/ext/oci8/tests/details.inc
@@ -1,16 +1,25 @@
<?php
-/*
-* Please, change user, password and dbase to match your configuration.
-*
-* */
+/*
+ * Please change $user, $password and $dbase to match your configuration.
+ * Set $oracle_on_localhost to TRUE if the Oracle Database is installed on your localhost.
+ */
-$user = "system";
-$password = "system";
-$dbase = "oracle";
-
-/* Set this variable to TRUE if Oracle is installed @ localhost */
-
-$oracle_on_localhost = FALSE;
+if (false !== getenv('PHP_OCI8_TEST_DB')) {
+ $user = getenv('PHP_OCI8_TEST_USER'); // Database username for tests
+ $password = getenv('PHP_OCI8_TEST_PASS'); // Password for $user
+ $dbase = getenv('PHP_OCI8_TEST_DB'); // Database connection string
+ $oracle_on_localhost = getenv('PHP_OCI8_TEST_DB_ON_LOCALHOST');
+ if (false !== $oracle_on_localhost && 0 == strcasecmp($oracle_on_localhost,'TRUE')) {
+ $oracle_on_localhost = TRUE;
+ } else {
+ $oracle_on_localhost = FALSE;
+ }
+} else {
+ $user = "system";
+ $password = "system";
+ $dbase = "oracle";
+ $oracle_on_localhost = FALSE;
+}
?>
diff --git a/ext/oci8/tests/field_funcs.phpt b/ext/oci8/tests/field_funcs.phpt
index 102f2fdc0..18143f6f1 100644
--- a/ext/oci8/tests/field_funcs.phpt
+++ b/ext/oci8/tests/field_funcs.phpt
@@ -54,7 +54,7 @@ require dirname(__FILE__).'/drop_table.inc';
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
array(5) {
[0]=>
string(1) "1"
@@ -71,14 +71,14 @@ bool(false)
string(2) "ID"
string(6) "NUMBER"
int(2)
-int(%d)
+int(-127)
int(0)
int(22)
bool(false)
string(5) "VALUE"
string(6) "NUMBER"
int(2)
-int(%d)
+int(-127)
int(0)
int(22)
bool(true)
diff --git a/ext/oci8/tests/field_funcs2.phpt b/ext/oci8/tests/field_funcs2.phpt
new file mode 100644
index 000000000..9b8d3e5a2
--- /dev/null
+++ b/ext/oci8/tests/field_funcs2.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Bug #41917 (invalid scale and precision)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$s = oci_parse($c, 'drop table b41917t');
+@oci_execute($s);
+
+$t = array("C01" => "NUMBER",
+ "C02" => "NUMBER(*,1)",
+ "C03" => "NUMBER(9)",
+ "C04" => "NUMBER(9,2)",
+ "C05" => "NUMBER(9,1)",
+ "C06" => "NUMBER(7,-2)",
+ "C07" => "DECIMAL(4,9)",
+ "C08" => "NUMERIC(4,9)",
+ "C09" => "DECIMAL(4)",
+ "C10" => "INTEGER",
+ "C11" => "INT",
+ "C12" => "SMALLINT",
+ "C13" => "FLOAT",
+ "C14" => "FLOAT(9)",
+ "C15" => "DOUBLE PRECISION",
+ "C16" => "REAL",
+ );
+
+$stmt = "create table b41917t (\n";
+foreach ($t as $colname => $type) {
+ $stmt .= "$colname $type,\n";
+}
+$stmt[strlen($stmt)-2] = ")";
+
+$s = oci_parse($c, $stmt);
+oci_execute($s);
+
+$s = oci_parse($c, "select * from b41917t");
+oci_execute($s);
+
+for ($i = 1; $i <= oci_num_fields($s); $i++) {
+ $name = oci_field_name($s, $i);
+ $precision = oci_field_precision($s, $i);
+ $scale = oci_field_scale($s, $i);
+ echo "$name ".$t[$name] .": precision $precision, scale $scale\n";
+}
+
+echo "Done\n";
+?>
+--EXPECT--
+C01 NUMBER: precision 0, scale -127
+C02 NUMBER(*,1): precision 38, scale 1
+C03 NUMBER(9): precision 9, scale 0
+C04 NUMBER(9,2): precision 9, scale 2
+C05 NUMBER(9,1): precision 9, scale 1
+C06 NUMBER(7,-2): precision 7, scale -2
+C07 DECIMAL(4,9): precision 4, scale 9
+C08 NUMERIC(4,9): precision 4, scale 9
+C09 DECIMAL(4): precision 4, scale 0
+C10 INTEGER: precision 38, scale 0
+C11 INT: precision 38, scale 0
+C12 SMALLINT: precision 38, scale 0
+C13 FLOAT: precision 126, scale -127
+C14 FLOAT(9): precision 9, scale -127
+C15 DOUBLE PRECISION: precision 126, scale -127
+C16 REAL: precision 63, scale -127
+Done \ No newline at end of file
diff --git a/ext/oci8/tests/field_funcs_old.phpt b/ext/oci8/tests/field_funcs_old.phpt
index e6f21d613..e0d24cd7b 100644
--- a/ext/oci8/tests/field_funcs_old.phpt
+++ b/ext/oci8/tests/field_funcs_old.phpt
@@ -54,7 +54,7 @@ require dirname(__FILE__).'/drop_table.inc';
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
array(5) {
[0]=>
string(1) "1"
@@ -71,14 +71,14 @@ bool(false)
string(2) "ID"
string(6) "NUMBER"
int(2)
-int(%d)
+int(-127)
int(0)
int(22)
bool(false)
string(5) "VALUE"
string(6) "NUMBER"
int(2)
-int(%d)
+int(-127)
int(0)
int(22)
bool(true)
diff --git a/ext/oci8/tests/lob_040.phpt b/ext/oci8/tests/lob_040.phpt
new file mode 100644
index 000000000..3f8a73dc5
--- /dev/null
+++ b/ext/oci8/tests/lob_040.phpt
@@ -0,0 +1,1041 @@
+--TEST--
+Bug #37706 (Test LOB locator reuse. Extends simple test of lob_037.phpt)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+define('NUMLOBS', 200);
+
+require(dirname(__FILE__).'/connect.inc');
+require(dirname(__FILE__).'/create_table.inc');
+
+for ($i = 0; $i < NUMLOBS; $i++) {
+ $s = oci_parse($c, "insert into ".$schema.$table_name." (id, clob) values(".$i.", '".$i."aaaa".$i.$i."aaaaaaaaaaaaaaaaaaaaaaaaaaaz')");
+ oci_execute($s);
+}
+
+echo "Test 1: CLOB as locator\n";
+
+$s = oci_parse($c, "select clob from ".$schema.$table_name." order by id");
+oci_execute($s);
+
+$row = array();
+for ($i = 0; $i < NUMLOBS; $i++) {
+ $row[$i] = oci_fetch_array($s, OCI_NUM);
+}
+
+for ($i = 0; $i < NUMLOBS; $i++) {
+ echo "Row $i Size: " . $row[$i][0]->size() . "\n";;
+ echo "Pos 1: " . $row[$i][0]->tell() . "\n";
+ echo "Data: " . $row[$i][0]->read(5) . "\n";;
+ echo "Pos 2: " . $row[$i][0]->tell() . "\n";
+ echo "Data: " . $row[$i][0]->read(12) . "\n";
+}
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Test 1: CLOB as locator
+Row 0 Size: 35
+Pos 1: 0
+Data: 0aaaa
+Pos 2: 5
+Data: 00aaaaaaaaaa
+Row 1 Size: 35
+Pos 1: 0
+Data: 1aaaa
+Pos 2: 5
+Data: 11aaaaaaaaaa
+Row 2 Size: 35
+Pos 1: 0
+Data: 2aaaa
+Pos 2: 5
+Data: 22aaaaaaaaaa
+Row 3 Size: 35
+Pos 1: 0
+Data: 3aaaa
+Pos 2: 5
+Data: 33aaaaaaaaaa
+Row 4 Size: 35
+Pos 1: 0
+Data: 4aaaa
+Pos 2: 5
+Data: 44aaaaaaaaaa
+Row 5 Size: 35
+Pos 1: 0
+Data: 5aaaa
+Pos 2: 5
+Data: 55aaaaaaaaaa
+Row 6 Size: 35
+Pos 1: 0
+Data: 6aaaa
+Pos 2: 5
+Data: 66aaaaaaaaaa
+Row 7 Size: 35
+Pos 1: 0
+Data: 7aaaa
+Pos 2: 5
+Data: 77aaaaaaaaaa
+Row 8 Size: 35
+Pos 1: 0
+Data: 8aaaa
+Pos 2: 5
+Data: 88aaaaaaaaaa
+Row 9 Size: 35
+Pos 1: 0
+Data: 9aaaa
+Pos 2: 5
+Data: 99aaaaaaaaaa
+Row 10 Size: 38
+Pos 1: 0
+Data: 10aaa
+Pos 2: 5
+Data: a1010aaaaaaa
+Row 11 Size: 38
+Pos 1: 0
+Data: 11aaa
+Pos 2: 5
+Data: a1111aaaaaaa
+Row 12 Size: 38
+Pos 1: 0
+Data: 12aaa
+Pos 2: 5
+Data: a1212aaaaaaa
+Row 13 Size: 38
+Pos 1: 0
+Data: 13aaa
+Pos 2: 5
+Data: a1313aaaaaaa
+Row 14 Size: 38
+Pos 1: 0
+Data: 14aaa
+Pos 2: 5
+Data: a1414aaaaaaa
+Row 15 Size: 38
+Pos 1: 0
+Data: 15aaa
+Pos 2: 5
+Data: a1515aaaaaaa
+Row 16 Size: 38
+Pos 1: 0
+Data: 16aaa
+Pos 2: 5
+Data: a1616aaaaaaa
+Row 17 Size: 38
+Pos 1: 0
+Data: 17aaa
+Pos 2: 5
+Data: a1717aaaaaaa
+Row 18 Size: 38
+Pos 1: 0
+Data: 18aaa
+Pos 2: 5
+Data: a1818aaaaaaa
+Row 19 Size: 38
+Pos 1: 0
+Data: 19aaa
+Pos 2: 5
+Data: a1919aaaaaaa
+Row 20 Size: 38
+Pos 1: 0
+Data: 20aaa
+Pos 2: 5
+Data: a2020aaaaaaa
+Row 21 Size: 38
+Pos 1: 0
+Data: 21aaa
+Pos 2: 5
+Data: a2121aaaaaaa
+Row 22 Size: 38
+Pos 1: 0
+Data: 22aaa
+Pos 2: 5
+Data: a2222aaaaaaa
+Row 23 Size: 38
+Pos 1: 0
+Data: 23aaa
+Pos 2: 5
+Data: a2323aaaaaaa
+Row 24 Size: 38
+Pos 1: 0
+Data: 24aaa
+Pos 2: 5
+Data: a2424aaaaaaa
+Row 25 Size: 38
+Pos 1: 0
+Data: 25aaa
+Pos 2: 5
+Data: a2525aaaaaaa
+Row 26 Size: 38
+Pos 1: 0
+Data: 26aaa
+Pos 2: 5
+Data: a2626aaaaaaa
+Row 27 Size: 38
+Pos 1: 0
+Data: 27aaa
+Pos 2: 5
+Data: a2727aaaaaaa
+Row 28 Size: 38
+Pos 1: 0
+Data: 28aaa
+Pos 2: 5
+Data: a2828aaaaaaa
+Row 29 Size: 38
+Pos 1: 0
+Data: 29aaa
+Pos 2: 5
+Data: a2929aaaaaaa
+Row 30 Size: 38
+Pos 1: 0
+Data: 30aaa
+Pos 2: 5
+Data: a3030aaaaaaa
+Row 31 Size: 38
+Pos 1: 0
+Data: 31aaa
+Pos 2: 5
+Data: a3131aaaaaaa
+Row 32 Size: 38
+Pos 1: 0
+Data: 32aaa
+Pos 2: 5
+Data: a3232aaaaaaa
+Row 33 Size: 38
+Pos 1: 0
+Data: 33aaa
+Pos 2: 5
+Data: a3333aaaaaaa
+Row 34 Size: 38
+Pos 1: 0
+Data: 34aaa
+Pos 2: 5
+Data: a3434aaaaaaa
+Row 35 Size: 38
+Pos 1: 0
+Data: 35aaa
+Pos 2: 5
+Data: a3535aaaaaaa
+Row 36 Size: 38
+Pos 1: 0
+Data: 36aaa
+Pos 2: 5
+Data: a3636aaaaaaa
+Row 37 Size: 38
+Pos 1: 0
+Data: 37aaa
+Pos 2: 5
+Data: a3737aaaaaaa
+Row 38 Size: 38
+Pos 1: 0
+Data: 38aaa
+Pos 2: 5
+Data: a3838aaaaaaa
+Row 39 Size: 38
+Pos 1: 0
+Data: 39aaa
+Pos 2: 5
+Data: a3939aaaaaaa
+Row 40 Size: 38
+Pos 1: 0
+Data: 40aaa
+Pos 2: 5
+Data: a4040aaaaaaa
+Row 41 Size: 38
+Pos 1: 0
+Data: 41aaa
+Pos 2: 5
+Data: a4141aaaaaaa
+Row 42 Size: 38
+Pos 1: 0
+Data: 42aaa
+Pos 2: 5
+Data: a4242aaaaaaa
+Row 43 Size: 38
+Pos 1: 0
+Data: 43aaa
+Pos 2: 5
+Data: a4343aaaaaaa
+Row 44 Size: 38
+Pos 1: 0
+Data: 44aaa
+Pos 2: 5
+Data: a4444aaaaaaa
+Row 45 Size: 38
+Pos 1: 0
+Data: 45aaa
+Pos 2: 5
+Data: a4545aaaaaaa
+Row 46 Size: 38
+Pos 1: 0
+Data: 46aaa
+Pos 2: 5
+Data: a4646aaaaaaa
+Row 47 Size: 38
+Pos 1: 0
+Data: 47aaa
+Pos 2: 5
+Data: a4747aaaaaaa
+Row 48 Size: 38
+Pos 1: 0
+Data: 48aaa
+Pos 2: 5
+Data: a4848aaaaaaa
+Row 49 Size: 38
+Pos 1: 0
+Data: 49aaa
+Pos 2: 5
+Data: a4949aaaaaaa
+Row 50 Size: 38
+Pos 1: 0
+Data: 50aaa
+Pos 2: 5
+Data: a5050aaaaaaa
+Row 51 Size: 38
+Pos 1: 0
+Data: 51aaa
+Pos 2: 5
+Data: a5151aaaaaaa
+Row 52 Size: 38
+Pos 1: 0
+Data: 52aaa
+Pos 2: 5
+Data: a5252aaaaaaa
+Row 53 Size: 38
+Pos 1: 0
+Data: 53aaa
+Pos 2: 5
+Data: a5353aaaaaaa
+Row 54 Size: 38
+Pos 1: 0
+Data: 54aaa
+Pos 2: 5
+Data: a5454aaaaaaa
+Row 55 Size: 38
+Pos 1: 0
+Data: 55aaa
+Pos 2: 5
+Data: a5555aaaaaaa
+Row 56 Size: 38
+Pos 1: 0
+Data: 56aaa
+Pos 2: 5
+Data: a5656aaaaaaa
+Row 57 Size: 38
+Pos 1: 0
+Data: 57aaa
+Pos 2: 5
+Data: a5757aaaaaaa
+Row 58 Size: 38
+Pos 1: 0
+Data: 58aaa
+Pos 2: 5
+Data: a5858aaaaaaa
+Row 59 Size: 38
+Pos 1: 0
+Data: 59aaa
+Pos 2: 5
+Data: a5959aaaaaaa
+Row 60 Size: 38
+Pos 1: 0
+Data: 60aaa
+Pos 2: 5
+Data: a6060aaaaaaa
+Row 61 Size: 38
+Pos 1: 0
+Data: 61aaa
+Pos 2: 5
+Data: a6161aaaaaaa
+Row 62 Size: 38
+Pos 1: 0
+Data: 62aaa
+Pos 2: 5
+Data: a6262aaaaaaa
+Row 63 Size: 38
+Pos 1: 0
+Data: 63aaa
+Pos 2: 5
+Data: a6363aaaaaaa
+Row 64 Size: 38
+Pos 1: 0
+Data: 64aaa
+Pos 2: 5
+Data: a6464aaaaaaa
+Row 65 Size: 38
+Pos 1: 0
+Data: 65aaa
+Pos 2: 5
+Data: a6565aaaaaaa
+Row 66 Size: 38
+Pos 1: 0
+Data: 66aaa
+Pos 2: 5
+Data: a6666aaaaaaa
+Row 67 Size: 38
+Pos 1: 0
+Data: 67aaa
+Pos 2: 5
+Data: a6767aaaaaaa
+Row 68 Size: 38
+Pos 1: 0
+Data: 68aaa
+Pos 2: 5
+Data: a6868aaaaaaa
+Row 69 Size: 38
+Pos 1: 0
+Data: 69aaa
+Pos 2: 5
+Data: a6969aaaaaaa
+Row 70 Size: 38
+Pos 1: 0
+Data: 70aaa
+Pos 2: 5
+Data: a7070aaaaaaa
+Row 71 Size: 38
+Pos 1: 0
+Data: 71aaa
+Pos 2: 5
+Data: a7171aaaaaaa
+Row 72 Size: 38
+Pos 1: 0
+Data: 72aaa
+Pos 2: 5
+Data: a7272aaaaaaa
+Row 73 Size: 38
+Pos 1: 0
+Data: 73aaa
+Pos 2: 5
+Data: a7373aaaaaaa
+Row 74 Size: 38
+Pos 1: 0
+Data: 74aaa
+Pos 2: 5
+Data: a7474aaaaaaa
+Row 75 Size: 38
+Pos 1: 0
+Data: 75aaa
+Pos 2: 5
+Data: a7575aaaaaaa
+Row 76 Size: 38
+Pos 1: 0
+Data: 76aaa
+Pos 2: 5
+Data: a7676aaaaaaa
+Row 77 Size: 38
+Pos 1: 0
+Data: 77aaa
+Pos 2: 5
+Data: a7777aaaaaaa
+Row 78 Size: 38
+Pos 1: 0
+Data: 78aaa
+Pos 2: 5
+Data: a7878aaaaaaa
+Row 79 Size: 38
+Pos 1: 0
+Data: 79aaa
+Pos 2: 5
+Data: a7979aaaaaaa
+Row 80 Size: 38
+Pos 1: 0
+Data: 80aaa
+Pos 2: 5
+Data: a8080aaaaaaa
+Row 81 Size: 38
+Pos 1: 0
+Data: 81aaa
+Pos 2: 5
+Data: a8181aaaaaaa
+Row 82 Size: 38
+Pos 1: 0
+Data: 82aaa
+Pos 2: 5
+Data: a8282aaaaaaa
+Row 83 Size: 38
+Pos 1: 0
+Data: 83aaa
+Pos 2: 5
+Data: a8383aaaaaaa
+Row 84 Size: 38
+Pos 1: 0
+Data: 84aaa
+Pos 2: 5
+Data: a8484aaaaaaa
+Row 85 Size: 38
+Pos 1: 0
+Data: 85aaa
+Pos 2: 5
+Data: a8585aaaaaaa
+Row 86 Size: 38
+Pos 1: 0
+Data: 86aaa
+Pos 2: 5
+Data: a8686aaaaaaa
+Row 87 Size: 38
+Pos 1: 0
+Data: 87aaa
+Pos 2: 5
+Data: a8787aaaaaaa
+Row 88 Size: 38
+Pos 1: 0
+Data: 88aaa
+Pos 2: 5
+Data: a8888aaaaaaa
+Row 89 Size: 38
+Pos 1: 0
+Data: 89aaa
+Pos 2: 5
+Data: a8989aaaaaaa
+Row 90 Size: 38
+Pos 1: 0
+Data: 90aaa
+Pos 2: 5
+Data: a9090aaaaaaa
+Row 91 Size: 38
+Pos 1: 0
+Data: 91aaa
+Pos 2: 5
+Data: a9191aaaaaaa
+Row 92 Size: 38
+Pos 1: 0
+Data: 92aaa
+Pos 2: 5
+Data: a9292aaaaaaa
+Row 93 Size: 38
+Pos 1: 0
+Data: 93aaa
+Pos 2: 5
+Data: a9393aaaaaaa
+Row 94 Size: 38
+Pos 1: 0
+Data: 94aaa
+Pos 2: 5
+Data: a9494aaaaaaa
+Row 95 Size: 38
+Pos 1: 0
+Data: 95aaa
+Pos 2: 5
+Data: a9595aaaaaaa
+Row 96 Size: 38
+Pos 1: 0
+Data: 96aaa
+Pos 2: 5
+Data: a9696aaaaaaa
+Row 97 Size: 38
+Pos 1: 0
+Data: 97aaa
+Pos 2: 5
+Data: a9797aaaaaaa
+Row 98 Size: 38
+Pos 1: 0
+Data: 98aaa
+Pos 2: 5
+Data: a9898aaaaaaa
+Row 99 Size: 38
+Pos 1: 0
+Data: 99aaa
+Pos 2: 5
+Data: a9999aaaaaaa
+Row 100 Size: 41
+Pos 1: 0
+Data: 100aa
+Pos 2: 5
+Data: aa100100aaaa
+Row 101 Size: 41
+Pos 1: 0
+Data: 101aa
+Pos 2: 5
+Data: aa101101aaaa
+Row 102 Size: 41
+Pos 1: 0
+Data: 102aa
+Pos 2: 5
+Data: aa102102aaaa
+Row 103 Size: 41
+Pos 1: 0
+Data: 103aa
+Pos 2: 5
+Data: aa103103aaaa
+Row 104 Size: 41
+Pos 1: 0
+Data: 104aa
+Pos 2: 5
+Data: aa104104aaaa
+Row 105 Size: 41
+Pos 1: 0
+Data: 105aa
+Pos 2: 5
+Data: aa105105aaaa
+Row 106 Size: 41
+Pos 1: 0
+Data: 106aa
+Pos 2: 5
+Data: aa106106aaaa
+Row 107 Size: 41
+Pos 1: 0
+Data: 107aa
+Pos 2: 5
+Data: aa107107aaaa
+Row 108 Size: 41
+Pos 1: 0
+Data: 108aa
+Pos 2: 5
+Data: aa108108aaaa
+Row 109 Size: 41
+Pos 1: 0
+Data: 109aa
+Pos 2: 5
+Data: aa109109aaaa
+Row 110 Size: 41
+Pos 1: 0
+Data: 110aa
+Pos 2: 5
+Data: aa110110aaaa
+Row 111 Size: 41
+Pos 1: 0
+Data: 111aa
+Pos 2: 5
+Data: aa111111aaaa
+Row 112 Size: 41
+Pos 1: 0
+Data: 112aa
+Pos 2: 5
+Data: aa112112aaaa
+Row 113 Size: 41
+Pos 1: 0
+Data: 113aa
+Pos 2: 5
+Data: aa113113aaaa
+Row 114 Size: 41
+Pos 1: 0
+Data: 114aa
+Pos 2: 5
+Data: aa114114aaaa
+Row 115 Size: 41
+Pos 1: 0
+Data: 115aa
+Pos 2: 5
+Data: aa115115aaaa
+Row 116 Size: 41
+Pos 1: 0
+Data: 116aa
+Pos 2: 5
+Data: aa116116aaaa
+Row 117 Size: 41
+Pos 1: 0
+Data: 117aa
+Pos 2: 5
+Data: aa117117aaaa
+Row 118 Size: 41
+Pos 1: 0
+Data: 118aa
+Pos 2: 5
+Data: aa118118aaaa
+Row 119 Size: 41
+Pos 1: 0
+Data: 119aa
+Pos 2: 5
+Data: aa119119aaaa
+Row 120 Size: 41
+Pos 1: 0
+Data: 120aa
+Pos 2: 5
+Data: aa120120aaaa
+Row 121 Size: 41
+Pos 1: 0
+Data: 121aa
+Pos 2: 5
+Data: aa121121aaaa
+Row 122 Size: 41
+Pos 1: 0
+Data: 122aa
+Pos 2: 5
+Data: aa122122aaaa
+Row 123 Size: 41
+Pos 1: 0
+Data: 123aa
+Pos 2: 5
+Data: aa123123aaaa
+Row 124 Size: 41
+Pos 1: 0
+Data: 124aa
+Pos 2: 5
+Data: aa124124aaaa
+Row 125 Size: 41
+Pos 1: 0
+Data: 125aa
+Pos 2: 5
+Data: aa125125aaaa
+Row 126 Size: 41
+Pos 1: 0
+Data: 126aa
+Pos 2: 5
+Data: aa126126aaaa
+Row 127 Size: 41
+Pos 1: 0
+Data: 127aa
+Pos 2: 5
+Data: aa127127aaaa
+Row 128 Size: 41
+Pos 1: 0
+Data: 128aa
+Pos 2: 5
+Data: aa128128aaaa
+Row 129 Size: 41
+Pos 1: 0
+Data: 129aa
+Pos 2: 5
+Data: aa129129aaaa
+Row 130 Size: 41
+Pos 1: 0
+Data: 130aa
+Pos 2: 5
+Data: aa130130aaaa
+Row 131 Size: 41
+Pos 1: 0
+Data: 131aa
+Pos 2: 5
+Data: aa131131aaaa
+Row 132 Size: 41
+Pos 1: 0
+Data: 132aa
+Pos 2: 5
+Data: aa132132aaaa
+Row 133 Size: 41
+Pos 1: 0
+Data: 133aa
+Pos 2: 5
+Data: aa133133aaaa
+Row 134 Size: 41
+Pos 1: 0
+Data: 134aa
+Pos 2: 5
+Data: aa134134aaaa
+Row 135 Size: 41
+Pos 1: 0
+Data: 135aa
+Pos 2: 5
+Data: aa135135aaaa
+Row 136 Size: 41
+Pos 1: 0
+Data: 136aa
+Pos 2: 5
+Data: aa136136aaaa
+Row 137 Size: 41
+Pos 1: 0
+Data: 137aa
+Pos 2: 5
+Data: aa137137aaaa
+Row 138 Size: 41
+Pos 1: 0
+Data: 138aa
+Pos 2: 5
+Data: aa138138aaaa
+Row 139 Size: 41
+Pos 1: 0
+Data: 139aa
+Pos 2: 5
+Data: aa139139aaaa
+Row 140 Size: 41
+Pos 1: 0
+Data: 140aa
+Pos 2: 5
+Data: aa140140aaaa
+Row 141 Size: 41
+Pos 1: 0
+Data: 141aa
+Pos 2: 5
+Data: aa141141aaaa
+Row 142 Size: 41
+Pos 1: 0
+Data: 142aa
+Pos 2: 5
+Data: aa142142aaaa
+Row 143 Size: 41
+Pos 1: 0
+Data: 143aa
+Pos 2: 5
+Data: aa143143aaaa
+Row 144 Size: 41
+Pos 1: 0
+Data: 144aa
+Pos 2: 5
+Data: aa144144aaaa
+Row 145 Size: 41
+Pos 1: 0
+Data: 145aa
+Pos 2: 5
+Data: aa145145aaaa
+Row 146 Size: 41
+Pos 1: 0
+Data: 146aa
+Pos 2: 5
+Data: aa146146aaaa
+Row 147 Size: 41
+Pos 1: 0
+Data: 147aa
+Pos 2: 5
+Data: aa147147aaaa
+Row 148 Size: 41
+Pos 1: 0
+Data: 148aa
+Pos 2: 5
+Data: aa148148aaaa
+Row 149 Size: 41
+Pos 1: 0
+Data: 149aa
+Pos 2: 5
+Data: aa149149aaaa
+Row 150 Size: 41
+Pos 1: 0
+Data: 150aa
+Pos 2: 5
+Data: aa150150aaaa
+Row 151 Size: 41
+Pos 1: 0
+Data: 151aa
+Pos 2: 5
+Data: aa151151aaaa
+Row 152 Size: 41
+Pos 1: 0
+Data: 152aa
+Pos 2: 5
+Data: aa152152aaaa
+Row 153 Size: 41
+Pos 1: 0
+Data: 153aa
+Pos 2: 5
+Data: aa153153aaaa
+Row 154 Size: 41
+Pos 1: 0
+Data: 154aa
+Pos 2: 5
+Data: aa154154aaaa
+Row 155 Size: 41
+Pos 1: 0
+Data: 155aa
+Pos 2: 5
+Data: aa155155aaaa
+Row 156 Size: 41
+Pos 1: 0
+Data: 156aa
+Pos 2: 5
+Data: aa156156aaaa
+Row 157 Size: 41
+Pos 1: 0
+Data: 157aa
+Pos 2: 5
+Data: aa157157aaaa
+Row 158 Size: 41
+Pos 1: 0
+Data: 158aa
+Pos 2: 5
+Data: aa158158aaaa
+Row 159 Size: 41
+Pos 1: 0
+Data: 159aa
+Pos 2: 5
+Data: aa159159aaaa
+Row 160 Size: 41
+Pos 1: 0
+Data: 160aa
+Pos 2: 5
+Data: aa160160aaaa
+Row 161 Size: 41
+Pos 1: 0
+Data: 161aa
+Pos 2: 5
+Data: aa161161aaaa
+Row 162 Size: 41
+Pos 1: 0
+Data: 162aa
+Pos 2: 5
+Data: aa162162aaaa
+Row 163 Size: 41
+Pos 1: 0
+Data: 163aa
+Pos 2: 5
+Data: aa163163aaaa
+Row 164 Size: 41
+Pos 1: 0
+Data: 164aa
+Pos 2: 5
+Data: aa164164aaaa
+Row 165 Size: 41
+Pos 1: 0
+Data: 165aa
+Pos 2: 5
+Data: aa165165aaaa
+Row 166 Size: 41
+Pos 1: 0
+Data: 166aa
+Pos 2: 5
+Data: aa166166aaaa
+Row 167 Size: 41
+Pos 1: 0
+Data: 167aa
+Pos 2: 5
+Data: aa167167aaaa
+Row 168 Size: 41
+Pos 1: 0
+Data: 168aa
+Pos 2: 5
+Data: aa168168aaaa
+Row 169 Size: 41
+Pos 1: 0
+Data: 169aa
+Pos 2: 5
+Data: aa169169aaaa
+Row 170 Size: 41
+Pos 1: 0
+Data: 170aa
+Pos 2: 5
+Data: aa170170aaaa
+Row 171 Size: 41
+Pos 1: 0
+Data: 171aa
+Pos 2: 5
+Data: aa171171aaaa
+Row 172 Size: 41
+Pos 1: 0
+Data: 172aa
+Pos 2: 5
+Data: aa172172aaaa
+Row 173 Size: 41
+Pos 1: 0
+Data: 173aa
+Pos 2: 5
+Data: aa173173aaaa
+Row 174 Size: 41
+Pos 1: 0
+Data: 174aa
+Pos 2: 5
+Data: aa174174aaaa
+Row 175 Size: 41
+Pos 1: 0
+Data: 175aa
+Pos 2: 5
+Data: aa175175aaaa
+Row 176 Size: 41
+Pos 1: 0
+Data: 176aa
+Pos 2: 5
+Data: aa176176aaaa
+Row 177 Size: 41
+Pos 1: 0
+Data: 177aa
+Pos 2: 5
+Data: aa177177aaaa
+Row 178 Size: 41
+Pos 1: 0
+Data: 178aa
+Pos 2: 5
+Data: aa178178aaaa
+Row 179 Size: 41
+Pos 1: 0
+Data: 179aa
+Pos 2: 5
+Data: aa179179aaaa
+Row 180 Size: 41
+Pos 1: 0
+Data: 180aa
+Pos 2: 5
+Data: aa180180aaaa
+Row 181 Size: 41
+Pos 1: 0
+Data: 181aa
+Pos 2: 5
+Data: aa181181aaaa
+Row 182 Size: 41
+Pos 1: 0
+Data: 182aa
+Pos 2: 5
+Data: aa182182aaaa
+Row 183 Size: 41
+Pos 1: 0
+Data: 183aa
+Pos 2: 5
+Data: aa183183aaaa
+Row 184 Size: 41
+Pos 1: 0
+Data: 184aa
+Pos 2: 5
+Data: aa184184aaaa
+Row 185 Size: 41
+Pos 1: 0
+Data: 185aa
+Pos 2: 5
+Data: aa185185aaaa
+Row 186 Size: 41
+Pos 1: 0
+Data: 186aa
+Pos 2: 5
+Data: aa186186aaaa
+Row 187 Size: 41
+Pos 1: 0
+Data: 187aa
+Pos 2: 5
+Data: aa187187aaaa
+Row 188 Size: 41
+Pos 1: 0
+Data: 188aa
+Pos 2: 5
+Data: aa188188aaaa
+Row 189 Size: 41
+Pos 1: 0
+Data: 189aa
+Pos 2: 5
+Data: aa189189aaaa
+Row 190 Size: 41
+Pos 1: 0
+Data: 190aa
+Pos 2: 5
+Data: aa190190aaaa
+Row 191 Size: 41
+Pos 1: 0
+Data: 191aa
+Pos 2: 5
+Data: aa191191aaaa
+Row 192 Size: 41
+Pos 1: 0
+Data: 192aa
+Pos 2: 5
+Data: aa192192aaaa
+Row 193 Size: 41
+Pos 1: 0
+Data: 193aa
+Pos 2: 5
+Data: aa193193aaaa
+Row 194 Size: 41
+Pos 1: 0
+Data: 194aa
+Pos 2: 5
+Data: aa194194aaaa
+Row 195 Size: 41
+Pos 1: 0
+Data: 195aa
+Pos 2: 5
+Data: aa195195aaaa
+Row 196 Size: 41
+Pos 1: 0
+Data: 196aa
+Pos 2: 5
+Data: aa196196aaaa
+Row 197 Size: 41
+Pos 1: 0
+Data: 197aa
+Pos 2: 5
+Data: aa197197aaaa
+Row 198 Size: 41
+Pos 1: 0
+Data: 198aa
+Pos 2: 5
+Data: aa198198aaaa
+Row 199 Size: 41
+Pos 1: 0
+Data: 199aa
+Pos 2: 5
+Data: aa199199aaaa
+Done
diff --git a/ext/oci8/tests/lob_null.phpt b/ext/oci8/tests/lob_null.phpt
new file mode 100644
index 000000000..227ebb89f
--- /dev/null
+++ b/ext/oci8/tests/lob_null.phpt
@@ -0,0 +1,265 @@
+--TEST--
+Test null data for CLOBs
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+// Initialization
+
+$s = oci_parse($c, 'drop table lob_null_tab');
+@oci_execute($s);
+
+$s = oci_parse($c, 'create table lob_null_tab (id number, data clob)');
+oci_execute($s);
+
+$s = oci_parse($c,
+'create or replace procedure lob_null_proc_in (pid in number, pdata in CLOB)
+ as begin
+ insert into lob_null_tab (id, data) values (pid, pdata);
+ end;');
+oci_execute($s);
+
+$s = oci_parse($c,
+'create or replace procedure lob_null_proc_out (pid in number, pdata out clob)
+ as begin
+ select data into pdata from lob_null_tab where id = pid;
+ end;');
+oci_execute($s);
+
+// TEMPORARY CLOB
+
+echo "Temporary CLOB: NULL\n";
+$s = oci_parse($c, "insert into lob_null_tab values (1, :b)");
+$lob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s, ':b', $lob, -1, OCI_B_CLOB);
+$lob->writeTemporary(null);
+$r = @oci_execute($s);
+if (!$r) {
+ $m = oci_error($s);
+ echo $m['message'], "\n";
+}
+else {
+ $lob->close();
+}
+
+echo "Temporary CLOB: ''\n";
+$s = oci_parse($c, "insert into lob_null_tab values (2, :b)");
+$lob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s, ':b', $lob, -1, OCI_B_CLOB);
+$lob->writeTemporary('');
+$r = @oci_execute($s);
+if (!$r) {
+ $m = oci_error($s);
+ echo $m['message'], "\n";
+}
+else {
+ $lob->close();
+}
+
+echo "Temporary CLOB: text\n";
+$s = oci_parse($c, "insert into lob_null_tab values (3, :b)");
+$lob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s, ':b', $lob, -1, OCI_B_CLOB);
+$lob->writeTemporary('Inserted via SQL statement');
+$r = @oci_execute($s);
+if (!$r) {
+ $m = oci_error($s);
+ echo $m['message'], "\n";
+}
+else {
+ $lob->close();
+}
+
+// PROCEDURE PARAMETER
+
+echo "Procedure parameter: NULL\n";
+$s = oci_parse($c, "call lob_null_proc_in(4, :b)");
+$lob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s, ':b', $lob, -1, OCI_B_CLOB);
+$lob->writeTemporary(null);
+$r = @oci_execute($s);
+if (!$r) {
+ $m = oci_error($s);
+ echo $m['message'], "\n";
+}
+else {
+ $lob->close();
+}
+
+echo "Procedure parameter: ''\n";
+$s = oci_parse($c, "call lob_null_proc_in(5, :b)");
+$lob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s, ':b', $lob, -1, OCI_B_CLOB);
+$lob->writeTemporary('');
+$r = @oci_execute($s);
+if (!$r) {
+ $m = oci_error($s);
+ echo $m['message'], "\n";
+}
+else {
+ $lob->close();
+}
+
+echo "Procedure parameter: text\n";
+$s = oci_parse($c, "call lob_null_proc_in(6, :b)");
+$lob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s, ':b', $lob, -1, OCI_B_CLOB);
+$lob->writeTemporary('Inserted via procedure parameter');
+$r = @oci_execute($s);
+if (!$r) {
+ $m = oci_error($s);
+ echo $m['message'], "\n";
+}
+else {
+ $lob->close();
+}
+
+// RETURNING INTO
+
+echo "RETURNING INTO: null\n";
+$s = oci_parse($c, "insert into lob_null_tab values (7, empty_clob()) returning data into :b");
+$lob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s, ':b', $lob, -1, OCI_B_CLOB);
+oci_execute($s, OCI_DEFAULT); // Must have OCI_DEFAULT here so locator is still valid
+$lob->save(null);
+
+echo "RETURNING INTO: ''\n";
+$s = oci_parse($c, "insert into lob_null_tab values (8, empty_clob()) returning data into :b");
+$lob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s, ':b', $lob, -1, OCI_B_CLOB);
+oci_execute($s, OCI_DEFAULT); // Must have OCI_DEFAULT here so locator is still valid
+$lob->save('');
+
+echo "RETURNING INTO: text\n";
+$s = oci_parse($c, "insert into lob_null_tab values (9, empty_clob()) returning data into :b");
+$lob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s, ':b', $lob, -1, OCI_B_CLOB);
+oci_execute($s, OCI_DEFAULT); // Must have OCI_DEFAULT here so locator is still valid
+$lob->save('Inserted with RETURNING INTO');
+
+echo "Fetch as string\n";
+$s = oci_parse ($c, 'select id, data from lob_null_tab order by id');
+oci_execute($s);
+oci_fetch_all($s, $res);
+var_dump($res);
+
+echo "\nFetch as a descriptor\n";
+$s = oci_parse ($c, 'select id, data from lob_null_tab order by id');
+oci_execute($s);
+while ($arr = oci_fetch_assoc($s)) {
+ if (is_object($arr['DATA'])) {
+ echo $arr['ID'] . " is an object: ";
+ $r = $arr['DATA']->load();
+ var_dump($r);
+ }
+ else {
+ echo $arr['ID'] . " is not an object\n";
+ }
+}
+
+echo "\nFetch via the procedure parameter\n";
+for ($i = 1; $i <= 9; $i++)
+{
+ $s = oci_parse ($c, "call lob_null_proc_out($i, :b)");
+ $lob = oci_new_descriptor($c, OCI_D_LOB);
+ oci_bind_by_name($s, ':b', $lob, -1, OCI_B_CLOB);
+ oci_execute($s);
+ if (is_object($lob)) {
+ echo $i . " is an object: ";
+ $r = $lob->load();
+ var_dump($r);
+ }
+ else {
+ echo $i . " is not an object\n";
+ }
+}
+
+// Cleanup
+
+$s = oci_parse($c, 'drop table lob_null_tab');
+@oci_execute($s);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Temporary CLOB: NULL
+Temporary CLOB: ''
+Temporary CLOB: text
+Procedure parameter: NULL
+Procedure parameter: ''
+Procedure parameter: text
+RETURNING INTO: null
+RETURNING INTO: ''
+RETURNING INTO: text
+Fetch as string
+array(2) {
+ ["ID"]=>
+ array(9) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ [4]=>
+ string(1) "5"
+ [5]=>
+ string(1) "6"
+ [6]=>
+ string(1) "7"
+ [7]=>
+ string(1) "8"
+ [8]=>
+ string(1) "9"
+ }
+ ["DATA"]=>
+ array(9) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(26) "Inserted via SQL statement"
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(32) "Inserted via procedure parameter"
+ [6]=>
+ string(0) ""
+ [7]=>
+ string(0) ""
+ [8]=>
+ string(28) "Inserted with RETURNING INTO"
+ }
+}
+
+Fetch as a descriptor
+1 is an object: string(0) ""
+2 is an object: string(0) ""
+3 is an object: string(26) "Inserted via SQL statement"
+4 is an object: string(0) ""
+5 is an object: string(0) ""
+6 is an object: string(32) "Inserted via procedure parameter"
+7 is an object: string(0) ""
+8 is an object: string(0) ""
+9 is an object: string(28) "Inserted with RETURNING INTO"
+
+Fetch via the procedure parameter
+1 is an object: string(0) ""
+2 is an object: string(0) ""
+3 is an object: string(26) "Inserted via SQL statement"
+4 is an object: string(0) ""
+5 is an object: string(0) ""
+6 is an object: string(32) "Inserted via procedure parameter"
+7 is an object: string(0) ""
+8 is an object: string(0) ""
+9 is an object: string(28) "Inserted with RETURNING INTO"
+Done \ No newline at end of file
diff --git a/ext/oci8/tests/oci8safemode.phpt b/ext/oci8/tests/oci8safemode.phpt
new file mode 100644
index 000000000..4662b4448
--- /dev/null
+++ b/ext/oci8/tests/oci8safemode.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test functionality disabled in safe mode
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+safe_mode=On
+oci8.privileged_connect=On
+--FILE--
+<?php
+
+$c = oci_connect("hr", "hrpwd", "//localhost/XE", null, OCI_SYSDBA);
+
+$r = oci_password_change($c, "hr", "hrpwd", "hrpwd");
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: oci_connect(): Privileged connect is disabled in Safe Mode in %s on line %d
+
+Warning: oci_password_change(): is disabled in Safe Mode in %s on line %d
+Done
diff --git a/ext/oci8/tests/parse_error.phpt b/ext/oci8/tests/parse_error.phpt
new file mode 100644
index 000000000..8100e3170
--- /dev/null
+++ b/ext/oci8/tests/parse_error.phpt
@@ -0,0 +1,142 @@
+--TEST--
+Test error handling when persistent connection is passed to oci_error()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+// As part of the fix for Bug 42134, an error handling difference was
+// noticed when oci_error() was passed a persistent connection. This
+// was fixed and the behavior of oci_error() for all connections types
+// was made consistent.
+
+require(dirname(__FILE__).'/details.inc');
+
+// Test parse error for normal connection
+
+if (!empty($dbase)) {
+ $c1 = oci_connect($user,$password,$dbase);
+}
+else {
+ $c1 = oci_connect($user,$password);
+}
+
+$s = @oci_parse($c1, "select ' from dual");
+if (!$s) {
+ echo "Normal connection: Parse error\n";
+ $m = oci_error($c1);
+ var_dump($m);
+}
+
+// Test parse error for new connection
+
+if (!empty($dbase)) {
+ $c2 = oci_new_connect($user,$password,$dbase);
+}
+else {
+ $c2 = oci_new_connect($user,$password);
+}
+
+$s = @oci_parse($c2, "select ' from dual");
+if (!$s) {
+ echo "New connection: Parse error\n";
+ $m = oci_error($c2);
+ var_dump($m);
+}
+
+// Test parse error for persistent connection
+
+if (!empty($dbase)) {
+ $c3 = oci_pconnect($user,$password,$dbase);
+}
+else {
+ $c3 = oci_pconnect($user,$password);
+}
+
+$s = @oci_parse($c3, "select ' from dual");
+if (!$s) {
+ echo "Persistent connection: Parse error\n";
+ $m = oci_error($c3);
+ var_dump($m);
+}
+
+// Verify that passing no connection doesn't affect future calls
+
+$m = oci_error();
+echo "No connection: error: ";
+var_dump($m);
+
+// Check the errors are still accessible in the respective handles
+
+$m = oci_error($c1);
+echo "Normal connection (take #2): Parse error: ";
+echo $m["message"], "\n";
+
+$m = oci_error($c2);
+echo "New connection (take #2): Parse error: ";
+echo $m["message"], "\n";
+
+$m = oci_error($c3);
+echo "Persistent connection (take #2): Parse error: ";
+echo $m["message"], "\n";
+
+// Now create a new error for a normal connection and check all again
+
+$s = @oci_new_collection($c1, "ABC");
+$m = oci_error($c1);
+echo "Normal connection: New Collection error: ";
+echo $m["message"], "\n";
+
+$m = oci_error($c2);
+echo "New connection (take #3): Parse error: ";
+echo $m["message"], "\n";
+
+$m = oci_error($c3);
+echo "Persistent connection (take #3): Parse error: ";
+echo $m["message"], "\n";
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Normal connection: Parse error
+array(4) {
+ ["code"]=>
+ int(1756)
+ ["message"]=>
+ string(48) "ORA-01756: quoted string not properly terminated"
+ ["offset"]=>
+ int(0)
+ ["sqltext"]=>
+ string(0) ""
+}
+New connection: Parse error
+array(4) {
+ ["code"]=>
+ int(1756)
+ ["message"]=>
+ string(48) "ORA-01756: quoted string not properly terminated"
+ ["offset"]=>
+ int(0)
+ ["sqltext"]=>
+ string(0) ""
+}
+Persistent connection: Parse error
+array(4) {
+ ["code"]=>
+ int(1756)
+ ["message"]=>
+ string(48) "ORA-01756: quoted string not properly terminated"
+ ["offset"]=>
+ int(0)
+ ["sqltext"]=>
+ string(0) ""
+}
+No connection: error: bool(false)
+Normal connection (take #2): Parse error: ORA-01756: quoted string not properly terminated
+New connection (take #2): Parse error: ORA-01756: quoted string not properly terminated
+Persistent connection (take #2): Parse error: ORA-01756: quoted string not properly terminated
+Normal connection: New Collection error: OCI-22303: type ""."ABC" not found
+New connection (take #3): Parse error: ORA-01756: quoted string not properly terminated
+Persistent connection (take #3): Parse error: ORA-01756: quoted string not properly terminated
+Done
diff --git a/ext/oci8/tests/password_2.phpt b/ext/oci8/tests/password_2.phpt
new file mode 100644
index 000000000..be5cb8540
--- /dev/null
+++ b/ext/oci8/tests/password_2.phpt
@@ -0,0 +1,94 @@
+--TEST--
+oci_password_change() for persistent connections
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+require(dirname(__FILE__)."/details.inc");
+if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/details.inc");
+
+// Create a user we can stuff around with and not affect subsequent tests
+$c0 = oci_connect($user, $password, $dbase);
+$stmts = array(
+ "drop user testuser",
+ "begin
+ execute immediate 'create user testuser identified by testuserpwd';
+ execute immediate 'grant connect, create session to testuser';
+ end;");
+foreach ($stmts as $sql) {
+ $s = oci_parse($c0, $sql);
+ @oci_execute($s);
+}
+
+// Connect (persistent) and change the password
+$c1 = oci_pconnect("testuser", "testuserpwd", $dbase);
+var_dump($c1);
+
+ob_start();
+var_dump($c1);
+$r1 = ob_get_clean();
+preg_match("/resource\(([0-9])\) of.*/", $r1, $matches);
+$rn1 = $matches[1]; /* resource number */
+
+oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2");
+
+// Second connect should return a new resource because the hash string will be different from $c1
+$c2 = oci_pconnect("testuser", "testuserpwd2", $dbase);
+var_dump($c2);
+
+ob_start();
+var_dump($c2);
+$r2 = ob_get_clean();
+preg_match("/resource\(([0-9])\) of.*/", $r2, $matches);
+$rn2 = $matches[1]; /* resource number */
+
+// Despite using the old password this connect should succeed and return the original resource
+$c3 = oci_pconnect("testuser", "testuserpwd", $dbase);
+var_dump($c3);
+
+ob_start();
+var_dump($c3);
+$r3 = ob_get_clean();
+preg_match("/resource\(([0-9])\) of.*/", $r3, $matches);
+$rn3 = $matches[1]; /* resource number */
+
+// 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";
+}
+
+// Connections should be the same
+if ($rn1 == $rn3) {
+ echo "First and third connections share a resource: OK\n";
+}
+else {
+ echo "First and third connections are different: Not OK\n";
+ var_dump($c1);
+ var_dump($c2);
+}
+
+// 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_execute($s);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%d) of type (oci8 persistent connection)
+resource(%d) of type (oci8 persistent connection)
+resource(%d) of type (oci8 persistent connection)
+First and second connections are different: OK
+First and third connections share a resource: OK
+Done