]> granicus.if.org Git - php/commitdiff
add _not yet 100% complete_ Unicode support
authorAntony Dovgal <tony2001@php.net>
Fri, 10 Nov 2006 16:56:19 +0000 (16:56 +0000)
committerAntony Dovgal <tony2001@php.net>
Fri, 10 Nov 2006 16:56:19 +0000 (16:56 +0000)
collections, statements and BLOBs seem to be working ok
though there are still some things to be done in order to make oci_bind_array_by_name() work with U-strings

Notes:
- in Unicode mode OCI8 always speaks to Oracle server using UTF-16, so all the conversions are done by the client lib.
This is why character set parameter of oci_connect() and NLS_LANG are ignored in U-mode.

- BLOBs and CLOBs behave quite differently in U-mode.
Reading data from a CLOB would result in Unicode string, while BLOBs would return binary string.
Also, all LOB utilities work with _bytes_ when BLOB is used and _characters_ when it's CLOB.
It's not that obvious, but it does make a lot of sense to me.

76 files changed:
ext/oci8/oci8.c
ext/oci8/oci8_collection.c
ext/oci8/oci8_interface.c
ext/oci8/oci8_lob.c
ext/oci8/oci8_statement.c
ext/oci8/php_oci8_int.h
ext/oci8/tests/array_bind_005.phpt
ext/oci8/tests/array_bind_008.phpt
ext/oci8/tests/array_bind_010.phpt
ext/oci8/tests/bind_long.phpt
ext/oci8/tests/bind_long_raw.phpt
ext/oci8/tests/bind_raw.phpt
ext/oci8/tests/bug27303.phpt
ext/oci8/tests/bug27303_2.phpt
ext/oci8/tests/bug27303_4.phpt
ext/oci8/tests/bug35973.phpt
ext/oci8/tests/bug36096.phpt
ext/oci8/tests/coll_011.phpt
ext/oci8/tests/coll_011_func.phpt
ext/oci8/tests/coll_012.phpt
ext/oci8/tests/coll_012_func.phpt
ext/oci8/tests/coll_013.phpt
ext/oci8/tests/coll_013_func.phpt
ext/oci8/tests/coll_014.phpt
ext/oci8/tests/coll_014_func.phpt
ext/oci8/tests/commit.phpt
ext/oci8/tests/commit_old.phpt
ext/oci8/tests/cursor_bind.phpt
ext/oci8/tests/cursors.phpt
ext/oci8/tests/cursors_old.phpt
ext/oci8/tests/define.phpt
ext/oci8/tests/define1.phpt
ext/oci8/tests/define_old.phpt
ext/oci8/tests/error.phpt
ext/oci8/tests/error1.phpt
ext/oci8/tests/error_old.phpt
ext/oci8/tests/fetch.phpt
ext/oci8/tests/fetch_all.phpt
ext/oci8/tests/fetch_array.phpt
ext/oci8/tests/fetch_assoc.phpt
ext/oci8/tests/fetch_into.phpt
ext/oci8/tests/fetch_into1.phpt
ext/oci8/tests/fetch_into2.phpt
ext/oci8/tests/fetch_object.phpt
ext/oci8/tests/fetch_row.phpt
ext/oci8/tests/field_funcs.phpt
ext/oci8/tests/field_funcs1.phpt
ext/oci8/tests/field_funcs_old.phpt
ext/oci8/tests/lob_001.phpt
ext/oci8/tests/lob_002.phpt
ext/oci8/tests/lob_003.phpt
ext/oci8/tests/lob_004.phpt
ext/oci8/tests/lob_006.phpt
ext/oci8/tests/lob_007.phpt
ext/oci8/tests/lob_008.phpt
ext/oci8/tests/lob_010.phpt
ext/oci8/tests/lob_011.phpt
ext/oci8/tests/lob_012.phpt
ext/oci8/tests/lob_013.phpt
ext/oci8/tests/lob_014.phpt
ext/oci8/tests/lob_016.phpt
ext/oci8/tests/lob_017.phpt
ext/oci8/tests/lob_018.phpt
ext/oci8/tests/lob_019.phpt
ext/oci8/tests/lob_020.phpt
ext/oci8/tests/lob_021.phpt
ext/oci8/tests/lob_022.phpt
ext/oci8/tests/lob_023.phpt
ext/oci8/tests/lob_024.phpt
ext/oci8/tests/lob_025.phpt
ext/oci8/tests/lob_026.phpt
ext/oci8/tests/lob_temp.phpt
ext/oci8/tests/lob_temp1.phpt
ext/oci8/tests/pecl_bug8816.phpt
ext/oci8/tests/serverversion.phpt
ext/oci8/tests/statement_cache.phpt

index 39e3c28ee37b559ba72f0f199af6872bedc9b805..5be7991d8372a67b9f038af0199d2d85d1e0979d 100644 (file)
@@ -762,9 +762,9 @@ void php_oci_define_hash_dtor(void *data)
 
        zval_ptr_dtor(&define->zval);
 
-       if (define->name) {
-               efree(define->name);
-               define->name = NULL;
+       if (define->name.v) {
+               efree(define->name.v);
+               define->name.v = NULL;
        }
 }
 /* }}} */
@@ -813,8 +813,8 @@ void php_oci_column_hash_dtor(void *data)
                efree(column->data);
        }
 
-       if (column->name) {
-               efree(column->name);
+       if (column->name.v) {
+               efree(column->name.v);
        }
 }
 /* }}} */
@@ -863,7 +863,7 @@ sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC)
                case OCI_SUCCESS_WITH_INFO:
                        errcode = php_oci_fetch_errmsg(err_p, &errbuf TSRMLS_CC);
                        if (errbuf) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_SUCCESS_WITH_INFO: %s", errbuf);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_SUCCESS_WITH_INFO: %R", (UG(unicode) ? IS_UNICODE : IS_STRING), errbuf);
                                efree(errbuf);
                        } else {
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_SUCCESS_WITH_INFO: failed to fetch error message");
@@ -878,7 +878,7 @@ sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC)
                case OCI_ERROR: 
                        errcode = php_oci_fetch_errmsg(err_p, &errbuf TSRMLS_CC);
                        if (errbuf) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errbuf);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%R", (UG(unicode) ? IS_UNICODE : IS_STRING), errbuf);
                                efree(errbuf);
                        } else {
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to fetch error message");
@@ -909,18 +909,26 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC)
        text tmp_buf[PHP_OCI_ERRBUF_LEN];
 
        tmp_buf[0] = '\0';
-       
+
+       memset(tmp_buf, 0, sizeof(tmp_buf));
        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);
-               
-               if (tmp_buf_len && tmp_buf[tmp_buf_len - 1] == '\n') {
-                       tmp_buf[tmp_buf_len - 1] = '\0';
+               int tmp_buf_len;
+               if (UG(unicode)) {
+                       tmp_buf_len = u_strlen((UChar *)tmp_buf);
+                       if (tmp_buf_len && tmp_buf[UBYTES(tmp_buf_len - 1)] == '\n') {
+                               tmp_buf[UBYTES(tmp_buf_len - 1)] = '\0';
+                       }
+               } else {
+                       tmp_buf_len = strlen(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 = estrndup(tmp_buf, TEXT_BYTES(tmp_buf_len));
                }
        }
        return error_code;
@@ -929,12 +937,18 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC)
 #ifdef HAVE_OCI8_ATTR_STATEMENT
 /* {{{ php_oci_fetch_sqltext_offset()
  Compute offset in the SQL statement */
-int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, ub2 *error_offset TSRMLS_DC)
+int php_oci_fetch_sqltext_offset(php_oci_statement *statement,  zstr *sqltext, ub2 *error_offset TSRMLS_DC)
 {
-       *sqltext = NULL;
+       ub4 sqltext_len = 0;
+
+       *sqltext = NULL_ZSTR;
        *error_offset = 0;
 
-       PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (text *) sqltext, (ub4 *)0, OCI_ATTR_STATEMENT, statement->err));
+       if (UG(unicode)) {
+               PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *) &(sqltext->u), (ub4 *)&sqltext_len, OCI_ATTR_STATEMENT, statement->err));
+       } else {
+               PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *) &(sqltext->s), (ub4 *)&sqltext_len, OCI_ATTR_STATEMENT, statement->err));
+       }
        
        if (statement->errcode != OCI_SUCCESS) { 
                php_oci_error(statement->err, statement->errcode TSRMLS_CC);
@@ -956,22 +970,20 @@ int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, u
 void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclusive)
 {
        php_oci_connection *connection;
-       char *username, *password;
-       char *dbname = NULL, *charset = NULL;
+       zstr username, password;
+       zstr dbname, charset = NULL_ZSTR;
        int username_len = 0, password_len = 0;
        int dbname_len = 0, charset_len = 0;
+       zend_uchar username_type, password_type;
+       zend_uchar dbname_type, charset_type;
        long session_mode = OCI_DEFAULT;
 
        /* if a fourth parameter is handed over, it is the charset identifier (but is only used in Oracle 9i+) */
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ssl", &username, &username_len, &password, &password_len, &dbname, &dbname_len, &charset, &charset_len, &session_mode) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TT|TTl", &username, &username_len, &username_type, &password, &password_len, &password_type, &dbname, &dbname_len, &dbname_type, &charset, &charset_len, &charset_type, &session_mode) == FAILURE) {
                return;
        } 
-       
-       if (!charset_len) {
-               charset = NULL;
-       }
-       
-       connection = php_oci_do_connect_ex(username, username_len, password, password_len, NULL, 0, dbname, dbname_len, charset, session_mode, persistent, exclusive TSRMLS_CC);
+
+       connection = php_oci_do_connect_ex(username, username_len, password, password_len, NULL_ZSTR, 0, dbname, dbname_len, charset, session_mode, persistent, exclusive, username_type TSRMLS_CC);
 
        if (!connection) {
                RETURN_FALSE;
@@ -982,7 +994,7 @@ 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) */
-php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, long session_mode, int persistent, int exclusive TSRMLS_DC) 
+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;
        zend_rsrc_list_entry new_le;
@@ -1011,17 +1023,17 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
        }
 
        smart_str_appendl_ex(&hashed_details, "oci8___", sizeof("oci8___") - 1, 0);
-       smart_str_appendl_ex(&hashed_details, username, username_len, 0);
+       smart_str_appendl_ex(&hashed_details, username.s, USTR_BYTES(type, username_len), 0);
        smart_str_appendl_ex(&hashed_details, "__", sizeof("__") - 1, 0);
        if (password_len) {
                ulong password_hash;
-               password_hash = zend_inline_hash_func(password, password_len);
+               password_hash = zend_u_inline_hash_func(type, password, password_len);
                smart_str_append_unsigned_ex(&hashed_details, password_hash, 0);
        }
        smart_str_appendl_ex(&hashed_details, "__", sizeof("__") - 1, 0);
 
-       if (dbname) {
-               smart_str_appendl_ex(&hashed_details, dbname, dbname_len, 0);
+       if (dbname_len) {
+               smart_str_appendl_ex(&hashed_details, dbname.s, USTR_BYTES(type, dbname_len), 0);
        }
        smart_str_appendl_ex(&hashed_details, "__", sizeof("__") - 1, 0);
 
@@ -1031,26 +1043,31 @@ 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));
-               if (!charsetid) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid character set name: %s", charset);
-               } else {
-                       smart_str_append_unsigned_ex(&hashed_details, charsetid, 0);
+       if (!UG(unicode)) {
+               if (charset.s && *charset.s) {
+                       PHP_OCI_CALL_RETURN(charsetid, OCINlsCharSetNameToId, (OCI_G(env), charset.s));
+                       if (!charsetid) {
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid character set name: %s", charset.s);
+                       } else {
+                               smart_str_append_unsigned_ex(&hashed_details, charsetid, 0);
+                       }
                }
-       }
+               
 
-       /* use NLS_LANG if no or invalid charset specified */
-       if (!charsetid) {
-               size_t rsize = 0;
-               sword result;
+               /* use NLS_LANG if no or invalid charset specified */
+               
+               if (!charsetid) {
+                       size_t rsize = 0;
+                       sword result;
 
-               PHP_OCI_CALL_RETURN(result, OCINlsEnvironmentVariableGet, (&charsetid_nls_lang, 0, OCI_NLS_CHARSET_ID, 0, &rsize))
-               if (result != OCI_SUCCESS) {
-                       charsetid_nls_lang = 0;
+                       PHP_OCI_CALL_RETURN(result, OCINlsEnvironmentVariableGet, (&charsetid_nls_lang, 0, OCI_NLS_CHARSET_ID, 0, &rsize))
+                       if (result != OCI_SUCCESS) {
+                               charsetid_nls_lang = 0;
+                       }
+                       smart_str_append_unsigned_ex(&hashed_details, charsetid_nls_lang, 0);
                }
-               smart_str_append_unsigned_ex(&hashed_details, charsetid_nls_lang, 0);
        }
+               
 #else
        if (charset && *charset) {
                php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Your version of Oracle Client doesn't support setting the charset; bad or no charset conversions may result");
@@ -1065,7 +1082,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
        /* make it lowercase */
        php_strtolower(hashed_details.c, hashed_details.len);
        
-       if (!exclusive && !new_password) {
+       if (!exclusive && !new_password.v) {
                zend_bool found = 0;
 
                if (persistent && zend_hash_find(&EG(persistent_list), hashed_details.c, hashed_details.len+1, (void **) &le) == SUCCESS) {
@@ -1112,7 +1129,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
                                                        connection->used_this_request = 1;
                                                        tmp = (php_oci_connection *)zend_list_find(connection->rsrc_id, &rsrc_type);
 
-                                                       if (tmp != NULL && rsrc_type == le_pconnection && strlen(tmp->hash_key) == hashed_details.len &&
+                                                       if (tmp != NULL && rsrc_type == le_pconnection && tmp->hash_key_len == hashed_details.len &&
                                                                memcmp(tmp->hash_key, hashed_details.c, hashed_details.len) == 0 && zend_list_addref(connection->rsrc_id) == SUCCESS) {
                                                                /* do nothing */
                                                        } else {
@@ -1165,15 +1182,18 @@ open:
                if (alloc_non_persistent) {
                        connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection));
                        connection->hash_key = estrndup(hashed_details.c, hashed_details.len);
+                       connection->hash_key_len = hashed_details.len;
                        connection->is_persistent = 0;
                } else {
                        connection = (php_oci_connection *) calloc(1, sizeof(php_oci_connection));
                        connection->hash_key = zend_strndup(hashed_details.c, hashed_details.len);
+                       connection->hash_key_len = hashed_details.len;
                        connection->is_persistent = 1;
                }
        } else {
                connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection));
                connection->hash_key = estrndup(hashed_details.c, hashed_details.len);
+               connection->hash_key_len = hashed_details.len;
                connection->is_persistent = 0;
        }
 
@@ -1190,11 +1210,15 @@ open:
        /* allocate environment handle */
 #if HAVE_OCI_ENV_NLS_CREATE
 #define PHP_OCI_INIT_FUNC_NAME "OCIEnvNlsCreate"
-       
-       if (charsetid) {
-               connection->charset = charsetid;
+
+       if (UG(unicode)) {
+               connection->charset = OCI_UTF16ID;
        } else {
-               connection->charset = charsetid_nls_lang;
+               if (charsetid) {
+                       connection->charset = charsetid;
+               } else {
+                       connection->charset = charsetid_nls_lang;
+               }
        }
 
        /* create an environment using the character set id, Oracle 9i+ ONLY */
@@ -1225,7 +1249,7 @@ open:
                php_oci_connection_close(connection TSRMLS_CC);
                return NULL;
        }
-       
+
        /* allocate our server handle {{{ */    
        PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->server), OCI_HTYPE_SERVER, 0, NULL));
        
@@ -1236,7 +1260,7 @@ open:
        } /* }}} */
 
        /* attach to the server {{{ */
-       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIServerAttach, (connection->server, OCI_G(err), (text*)dbname, dbname_len, (ub4) OCI_DEFAULT));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIServerAttach, (connection->server, OCI_G(err), (text*)dbname.s, USTR_BYTES(type, dbname_len), (ub4) OCI_DEFAULT));
        
        if (OCI_G(errcode) != OCI_SUCCESS) {
                php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1273,8 +1297,8 @@ open:
        } /* }}} */
 
        /* set the username {{{ */
-       if (username) {
-               PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) username, (ub4) username_len, (ub4) OCI_ATTR_USERNAME, OCI_G(err)));
+       if (username.v) {
+               PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) username.s, (ub4) USTR_BYTES(type, username_len), (ub4) OCI_ATTR_USERNAME, OCI_G(err)));
                
                if (OCI_G(errcode) != OCI_SUCCESS) {
                        php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1284,8 +1308,8 @@ open:
        }/* }}} */
 
        /* set the password {{{ */
-       if (password) {
-               PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) password, (ub4) password_len, (ub4) OCI_ATTR_PASSWORD, OCI_G(err)));
+       if (password.v) {
+               PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) password.s, (ub4) USTR_BYTES(type, password_len), (ub4) OCI_ATTR_PASSWORD, OCI_G(err)));
                
                if (OCI_G(errcode) != OCI_SUCCESS) {
                        php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1312,9 +1336,9 @@ open:
                return NULL;
        } /* }}} */
 
-       if (new_password) {
+       if (new_password_len) {
                /* try to change password if new one was provided {{{ */
-               PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPasswordChange, (connection->svc, OCI_G(err), (text *)username, username_len, (text *)password, password_len, (text *)new_password, new_password_len, OCI_AUTH));
+               PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPasswordChange, (connection->svc, OCI_G(err), (text *)username.s, USTR_BYTES(type, username_len), (text *)password.s, USTR_BYTES(type, password_len), (text *)new_password.s, USTR_BYTES(type, new_password_len), OCI_AUTH));
 
                if (OCI_G(errcode) != OCI_SUCCESS) {
                        php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1344,7 +1368,7 @@ open:
                        case OCI_SYSDBA:
                        case OCI_SYSOPER:
                        default:
-                               if (username_len == 1 && username[0] == '/' && password_len == 0) {
+                               if (username_len == 1 && username.s[0] == '/' && password_len == 0) {
                                        PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_EXT, (ub4) session_mode));
                                } else {
                                        PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_RDBMS, (ub4) session_mode));
@@ -1387,13 +1411,13 @@ open:
                new_le.type = le_pconnection;
                connection->used_this_request = 1;
                connection->rsrc_id = zend_list_insert(connection, le_pconnection);
-               zend_hash_update(&EG(persistent_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL);
+               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) {
                connection->rsrc_id = zend_list_insert(connection, le_connection);
                new_le.ptr = (void *)connection->rsrc_id;
                new_le.type = le_index_ptr;
-               zend_hash_update(&EG(regular_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL);
+               zend_hash_update(&EG(regular_list), connection->hash_key, connection->hash_key_len+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL);
                OCI_G(num_links)++;
        } else {
                connection->rsrc_id = zend_list_insert(connection, le_connection);      
@@ -1543,9 +1567,9 @@ static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC)
 
 /* {{{ php_oci_password_change()
  Change password for the user with the username given */
-int php_oci_password_change(php_oci_connection *connection, char *user, int user_len, char *pass_old, int pass_old_len, char *pass_new, int pass_new_len TSRMLS_DC)
+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, user_len, (text *)pass_old, pass_old_len, (text *)pass_new, pass_new_len, OCI_DEFAULT));
+       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));
 
        if (connection->errcode != OCI_SUCCESS) {
                php_oci_error(connection->err, connection->errcode TSRMLS_CC);
@@ -1557,9 +1581,9 @@ int php_oci_password_change(php_oci_connection *connection, char *user, int user
 
 /* {{{ php_oci_server_get_version() 
  Get Oracle server version */
-int php_oci_server_get_version(php_oci_connection *connection, char **version TSRMLS_DC) 
+int php_oci_server_get_version(php_oci_connection *connection, zstr *version TSRMLS_DC) 
 {
-       char version_buff[256];
+       char version_buff[512];
 
        PHP_OCI_CALL_RETURN(connection->errcode, OCIServerVersion, (connection->svc, connection->err, (text*)version_buff, sizeof(version_buff), OCI_HTYPE_SVCCTX));
        
@@ -1568,8 +1592,12 @@ int php_oci_server_get_version(php_oci_connection *connection, char **version TS
                PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
                return 1;
        }
-       
-       *version = estrdup(version_buff);
+
+       if (UG(unicode)) {
+               version->u = eustrdup((UChar *)version_buff);
+       } else {
+               version->s = estrdup(version_buff);
+       }
        return 0;
 } /* }}} */
 
@@ -1580,7 +1608,7 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR
        php_oci_descriptor *descriptor;
        ub4 lob_length;
        int column_size;
-       char *lob_buffer;
+       zstr lob_buffer, zstr_data = (zstr)column->data;
        
        if (column->indicator == -1) { /* column is NULL */ 
                ZVAL_NULL(value); 
@@ -1609,19 +1637,35 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR
                }
 
                if (column->data_type != SQLT_RDD && (mode & PHP_OCI_RETURN_LOBS)) {
+                       php_oci_lob_type lob_type;
                        /* PHP_OCI_RETURN_LOBS means that we want the content of the LOB back instead of the locator */
                        
                        if (php_oci_lob_read(descriptor, -1, 0, &lob_buffer, &lob_length TSRMLS_CC)) {
                                ZVAL_FALSE(value);
                                return 1;
-                       } else {
-                               if (lob_length > 0) {
-                                       ZVAL_STRINGL(value, lob_buffer, lob_length, 0);
-                               } else {
-                                       ZVAL_EMPTY_STRING(value);
-                               }
-                               return 0;
                        }
+                               
+                       if (php_oci_lob_get_type(descriptor, &lob_type TSRMLS_CC) > 0) {
+                               return 1;
+                       }
+
+                       switch (lob_type) {
+                               case OCI_IS_CLOB:
+                                       if (lob_length > 0) {
+                                               ZVAL_TEXTL(value, lob_buffer, TEXT_CHARS(lob_length), 0);
+                                       } else {
+                                               ZVAL_EMPTY_TEXT(value);
+                                       }
+                                       break;
+                               case OCI_IS_BLOB:
+                                       if (lob_length > 0) {
+                                               ZVAL_STRINGL(value, lob_buffer.s, lob_length, 0);
+                                       } else {
+                                               ZVAL_EMPTY_STRING(value);
+                                       }
+                                       break;
+                       }
+                       return 0;
                } else { 
                        /* return the locator */
                        object_init_ex(value, oci_lob_class_entry_ptr);
@@ -1644,7 +1688,7 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR
                                return 0;
                }
                
-               ZVAL_STRINGL(value, column->data, column_size, 1);
+               ZVAL_TEXTL(value, zstr_data, TEXT_CHARS(column_size), 1);
        }
        return 0;
 }
@@ -1711,7 +1755,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
 
        for (i = 0; i < statement->ncolumns; i++) {
                
-               column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+               column = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
                
                if (column == NULL) {
                        continue;
@@ -1733,7 +1777,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
                                if (fetch_mode & PHP_OCI_NUM) {
                                        ZVAL_ADDREF(element);
                                }
-                               add_assoc_zval(return_value, column->name, element);
+                               add_u_assoc_zval(return_value, (UG(unicode) ? IS_UNICODE : IS_STRING), column->name, element);
                        }
                
                } else {
@@ -1741,7 +1785,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
                                add_index_null(return_value, i);
                        }
                        if (fetch_mode & PHP_OCI_ASSOC) {
-                               add_assoc_null(return_value, column->name);
+                               add_u_assoc_null(return_value, (UG(unicode) ? IS_UNICODE : IS_STRING), column->name);
                        }
                }
        }
index dbbaff618415edf44ddbd6b3361135ad737df16a..c46c354480ec2ff61f76a2ce6acbfdc07818007d 100644 (file)
@@ -44,7 +44,7 @@
 
 /* {{{ php_oci_collection_create() 
  Create and return connection handle */
-php_oci_collection * php_oci_collection_create(php_oci_connection* connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC)
+php_oci_collection * php_oci_collection_create(php_oci_connection* connection, zstr tdo, int tdo_len, zstr schema, int schema_len TSRMLS_DC)
 {      
        dvoid *dschp1;
        dvoid *parmp1;
@@ -62,10 +62,10 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
                         connection->env,
                         connection->err,
                         connection->svc,
-                        (text *) schema,
-                        (ub4) schema_len,
-                        (text *) tdo,
-                        (ub4) tdo_len,
+                        (text *) schema.s,
+                        (ub4) TEXT_BYTES(schema_len),
+                        (text *) tdo.s,
+                        (ub4) TEXT_BYTES(tdo_len),
                         (CONST text *) 0,
                         (ub4) 0,
                         OCI_DURATION_SESSION,
@@ -289,14 +289,14 @@ int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC)
 
 /* {{{ 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, char *date, int date_len TSRMLS_DC)
+int php_oci_collection_append_date(php_oci_collection *collection, zstr date, int date_len TSRMLS_DC)
 {
        OCIInd new_index = OCI_IND_NOTNULL;
        OCIDate oci_date;
        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, date.s, TEXT_BYTES(date_len), NULL, 0, NULL, 0, &oci_date));
 
        if (connection->errcode != OCI_SUCCESS) {
                /* failed to convert string to date */
@@ -324,14 +324,18 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i
 
 /* {{{ php_oci_collection_append_number()
  Append NUMBER to the end of the collection */
-int php_oci_collection_append_number(php_oci_collection *collection, char *number, int number_len TSRMLS_DC)
+int php_oci_collection_append_number(php_oci_collection *collection, zstr number, int number_len TSRMLS_DC)
 {
        OCIInd new_index = OCI_IND_NOTNULL;
        double element_double;
        OCINumber oci_number;
        php_oci_connection *connection = collection->connection;
 
-       element_double = zend_strtod(number, NULL);
+       if (UG(unicode)) {
+               element_double = zend_u_strtod(number.u, NULL);
+       } else {
+               element_double = zend_strtod(number.s, NULL);
+       }
                        
        PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
 
@@ -360,13 +364,13 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe
 
 /* {{{ php_oci_collection_append_string() 
  Append STRING to the end of the collection */
-int php_oci_collection_append_string(php_oci_collection *collection, char *element, int element_len TSRMLS_DC)
+int php_oci_collection_append_string(php_oci_collection *collection, zstr element, int element_len TSRMLS_DC)
 {
        OCIInd new_index = OCI_IND_NOTNULL;
        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, element.s, TEXT_BYTES(element_len), &ocistr));
 
        if (connection->errcode != OCI_SUCCESS) {
                php_oci_error(connection->err, connection->errcode TSRMLS_CC);
@@ -393,7 +397,7 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme
 
 /* {{{ 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, char *element, int element_len TSRMLS_DC)
+int php_oci_collection_append(php_oci_collection *collection, zstr element, int element_len TSRMLS_DC)
 {
        if (element_len == 0) {
                return php_oci_collection_append_null(collection TSRMLS_CC);
@@ -484,9 +488,14 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
                                return 1;
                        }
 
-                       ZVAL_STRINGL(*result_element, buff, buff_len, 1);
-                       Z_STRVAL_P(*result_element)[buff_len] = '\0';
-                       
+                       if (UG(unicode)) {
+                               ZVAL_UNICODEL(*result_element, (UChar *)buff, TEXT_CHARS(buff_len), 1);
+                               /* Z_UNIVAL_P(*result_element)[buff_len] = 0; XXX */
+                       } else {
+                               ZVAL_STRINGL(*result_element, buff, buff_len, 1);
+                               Z_STRVAL_P(*result_element)[buff_len] = '\0';
+                       }
+
                        return 0;
                        break;
 
@@ -498,7 +507,11 @@ 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);
+                               if (UG(unicode)) {
+                                       ZVAL_UNICODE(*result_element, (UChar *)str, 1);
+                               } else { 
+                                       ZVAL_STRING(*result_element, str, 1);
+                               }
                        }
                        return 0;
                }
@@ -560,14 +573,14 @@ int php_oci_collection_element_set_null(php_oci_collection *collection, long ind
 
 /* {{{ 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, char *date, int date_len TSRMLS_DC)
+int php_oci_collection_element_set_date(php_oci_collection *collection, long index, zstr date, int date_len TSRMLS_DC)
 {
        OCIInd new_index = OCI_IND_NOTNULL;
        OCIDate oci_date;
        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, date.s, TEXT_BYTES(date_len), NULL, 0, NULL, 0, &oci_date));
 
        if (connection->errcode != OCI_SUCCESS) {
                /* failed to convert string to date */
@@ -596,14 +609,18 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind
 
 /* {{{ php_oci_collection_element_set_number()
  Change element's value to the given NUMBER */
-int php_oci_collection_element_set_number(php_oci_collection *collection, long index, char *number, int number_len TSRMLS_DC)
+int php_oci_collection_element_set_number(php_oci_collection *collection, long index, zstr number, int number_len TSRMLS_DC)
 {
        OCIInd new_index = OCI_IND_NOTNULL;
        double element_double;
        OCINumber oci_number;
        php_oci_connection *connection = collection->connection;
 
-       element_double = zend_strtod(number, NULL);
+       if (UG(unicode)) {
+               element_double = zend_u_strtod(number.u, NULL);
+       } else {
+               element_double = zend_strtod(number.s, NULL);
+       }
                        
        PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
 
@@ -633,13 +650,13 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i
 
 /* {{{ php_oci_collection_element_set_string()
  Change element's value to the given string */
-int php_oci_collection_element_set_string(php_oci_collection *collection, long index, char *element, int element_len TSRMLS_DC)
+int php_oci_collection_element_set_string(php_oci_collection *collection, long index, zstr element, int element_len TSRMLS_DC)
 {
        OCIInd new_index = OCI_IND_NOTNULL;
        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, element.s, TEXT_BYTES(element_len), &ocistr));
 
        if (connection->errcode != OCI_SUCCESS) {
                php_oci_error(connection->err, connection->errcode TSRMLS_CC);
@@ -667,7 +684,7 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i
 
 /* {{{ php_oci_collection_element_set()
  Collection element setter */
-int php_oci_collection_element_set(php_oci_collection *collection, long index, char *value, int value_len TSRMLS_DC)
+int php_oci_collection_element_set(php_oci_collection *collection, long index, zstr value, int value_len TSRMLS_DC)
 {
        if (value_len == 0) {
                return php_oci_collection_element_set_null(collection, index TSRMLS_CC);
index bee6971685b051b58f9281c24001e2e496451899..e9d3621b7e7bb6192c686baaf5fd37afc86d43df 100644 (file)
 PHP_FUNCTION(oci_define_by_name)
 {
        zval *stmt, *var;
-       char *name;
+       zstr name;
        int name_len;
+       zend_uchar name_type;
        long type = SQLT_CHR;
        php_oci_statement *statement;
        php_oci_define *define, *tmp_define;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz/|l", &stmt, &name, &name_len, &var, &type) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rtz/|l", &stmt, &name, &name_len, &name_type, &var, &type) == FAILURE) {
                return;
        }
 
@@ -70,7 +71,7 @@ PHP_FUNCTION(oci_define_by_name)
 
        define = ecalloc(1,sizeof(php_oci_define));
 
-       if (zend_hash_add(statement->defines, name, name_len, define, sizeof(php_oci_define), (void **)&tmp_define) == SUCCESS) {
+       if (zend_hash_add(statement->defines, name.s, USTR_BYTES(name_type, name_len+1), define, sizeof(php_oci_define), (void **)&tmp_define) == SUCCESS) {
                efree(define);
                define = tmp_define;
        } else {
@@ -78,8 +79,14 @@ PHP_FUNCTION(oci_define_by_name)
                RETURN_FALSE;
        }
 
-       define->name = (text*) estrndup(name, name_len);
+       if (name_type == IS_UNICODE) {
+               define->name.u = eustrndup(name.u, name_len);
+       } else {
+               define->name.s = estrndup(name.s, name_len);
+       }
+
        define->name_len = name_len;
+       define->name_type = name_type;
        define->type = type;
        define->zval = var;
        zval_add_ref(&var);
@@ -96,12 +103,13 @@ PHP_FUNCTION(oci_bind_by_name)
        ub2     bind_type = SQLT_CHR; /* unterminated string */
        int name_len;
        long maxlen = -1, type = 0;
-       char *name;
+       zstr name;
+       zend_uchar name_type;
        zval *z_statement;
        zval *bind_var = NULL;
        php_oci_statement *statement;
        
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz/|ll", &z_statement, &name, &name_len, &bind_var, &maxlen, &type) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rtz/|ll", &z_statement, &name, &name_len, &name_type, &bind_var, &maxlen, &type) == FAILURE) {
                return;
        }
 
@@ -111,7 +119,7 @@ PHP_FUNCTION(oci_bind_by_name)
        
        PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
 
-       if (php_oci_bind_by_name(statement, name, name_len, bind_var, maxlen, bind_type TSRMLS_CC)) {
+       if (php_oci_bind_by_name(statement, name, name_len, bind_var, maxlen, bind_type, name_type TSRMLS_CC)) {
                RETURN_FALSE;
        }
        RETURN_TRUE;
@@ -126,12 +134,13 @@ PHP_FUNCTION(oci_bind_array_by_name)
        long max_item_len = -1;
        long max_array_len = 0;
        long type = SQLT_AFC;
-       char *name;
+       zstr name;
+       zend_uchar name_type;
        zval *z_statement;
        zval *bind_var = NULL;
        php_oci_statement *statement;
        
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz/l|ll", &z_statement, &name, &name_len, &bind_var, &max_array_len, &max_item_len, &type) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rtz/l|ll", &z_statement, &name, &name_len, &name_type, &bind_var, &max_array_len, &max_item_len, &type) == FAILURE) {
                return;
        }
 
@@ -146,7 +155,7 @@ PHP_FUNCTION(oci_bind_array_by_name)
                RETURN_FALSE;
        }
        
-       if (php_oci_bind_array_by_name(statement, name, name_len, bind_var, max_array_len, max_item_len, type TSRMLS_CC)) {
+       if (php_oci_bind_array_by_name(statement, name, name_len, bind_var, max_array_len, max_item_len, type, name_type TSRMLS_CC)) {
                RETURN_FALSE;
        }
        RETURN_TRUE;
@@ -184,18 +193,18 @@ PHP_FUNCTION(oci_lob_save)
 {
        zval **tmp, *z_descriptor = getThis();
        php_oci_descriptor *descriptor;
-       char *data;
+       zstr data;
        int data_len;
+       zend_uchar data_type;
        long offset = 0;
        ub4 bytes_written;
 
        if (getThis()) {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &offset) == FAILURE) {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t|l", &data, &data_len, &data_type, &offset) == FAILURE) {
                        return;
                }
-       }
-       else {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &offset) == FAILURE) {
+       } else {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ot|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &data_type, &offset) == FAILURE) {
                        return;
                }
        }
@@ -211,8 +220,8 @@ PHP_FUNCTION(oci_lob_save)
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset parameter must be greater than or equal to 0");
                RETURN_FALSE;
        }
-       
-       if (php_oci_lob_write(descriptor, offset, data, data_len, &bytes_written TSRMLS_CC)) {
+
+       if (php_oci_lob_write(descriptor, offset, data, USTR_BYTES(data_type, data_len), &bytes_written TSRMLS_CC)) {
                RETURN_FALSE;
        }
        RETURN_TRUE;
@@ -259,8 +268,9 @@ PHP_FUNCTION(oci_lob_load)
 {
        zval **tmp, *z_descriptor = getThis();
        php_oci_descriptor *descriptor;
-       char *buffer = NULL;
+       zstr buffer = NULL_ZSTR;
        ub4 buffer_len;
+       php_oci_lob_type lob_type;
 
        if (!getThis()) {
                if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
@@ -278,11 +288,24 @@ PHP_FUNCTION(oci_lob_load)
        if (php_oci_lob_read(descriptor, -1, 0, &buffer, &buffer_len TSRMLS_CC)) {
                RETURN_FALSE;
        }
-       if (buffer_len > 0) {
-               RETURN_STRINGL(buffer, buffer_len, 0);
+       
+       if (php_oci_lob_get_type(descriptor, &lob_type TSRMLS_CC) > 0) {
+               RETURN_FALSE;
        }
-       else {
-               RETURN_EMPTY_STRING();
+
+       switch (lob_type) {
+               case OCI_IS_CLOB:
+                       if (buffer_len > 0) {
+                               RETURN_TEXTL(buffer, TEXT_CHARS(buffer_len), 0);
+                       }
+                       RETURN_EMPTY_TEXT();
+                       break;
+               case OCI_IS_BLOB:
+                       if (buffer_len > 0) {
+                               RETURN_STRINGL(buffer.s, buffer_len, 0);
+                       }
+                       RETURN_EMPTY_STRING();
+                       break;
        }
 }
 /* }}} */
@@ -294,8 +317,9 @@ PHP_FUNCTION(oci_lob_read)
        zval **tmp, *z_descriptor = getThis();
        php_oci_descriptor *descriptor;
        long length;
-       char *buffer;
+       zstr buffer;
        ub4 buffer_len;
+       php_oci_lob_type lob_type;
 
        if (getThis()) {
                if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &length) == FAILURE) {
@@ -322,12 +346,25 @@ PHP_FUNCTION(oci_lob_read)
        
        if (php_oci_lob_read(descriptor, length, descriptor->lob_current_position, &buffer, &buffer_len TSRMLS_CC)) {
                RETURN_FALSE;
-       }       
-       if (buffer_len > 0) {
-               RETURN_STRINGL(buffer, buffer_len, 0);
        }
-       else {
-               RETURN_EMPTY_STRING();
+       
+       if (php_oci_lob_get_type(descriptor, &lob_type TSRMLS_CC) > 0) {
+               RETURN_FALSE;
+       }
+
+       switch (lob_type) {
+               case OCI_IS_CLOB:
+                       if (buffer_len > 0) {
+                               RETURN_TEXTL(buffer, TEXT_CHARS(buffer_len), 0);
+                       }
+                       RETURN_EMPTY_TEXT();
+                       break;
+               case OCI_IS_BLOB:
+                       if (buffer_len > 0) {
+                               RETURN_STRINGL(buffer.s, buffer_len, 0);
+                       }
+                       RETURN_EMPTY_STRING();
+                       break;
        }
 }
 /* }}} */
@@ -439,7 +476,6 @@ PHP_FUNCTION(oci_lob_seek)
        
        PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
        
-       
        if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
                RETURN_FALSE;
        }
@@ -449,7 +485,7 @@ PHP_FUNCTION(oci_lob_seek)
                        descriptor->lob_current_position += offset;
                        break;
                case PHP_OCI_SEEK_END:
-                       if (descriptor->lob_size + offset >= 0) {
+                       if ((descriptor->lob_size + offset) >= 0) {
                                descriptor->lob_current_position = descriptor->lob_size + offset;
                        } 
                        else {
@@ -458,10 +494,9 @@ PHP_FUNCTION(oci_lob_seek)
                        break;
                case PHP_OCI_SEEK_SET:
                default:
-                               descriptor->lob_current_position = (offset > 0) ? offset : 0;
+                       descriptor->lob_current_position = (offset > 0) ? offset : 0;
                        break;
        }
-       
        RETURN_TRUE;
 }
 /* }}} */
@@ -503,10 +538,11 @@ PHP_FUNCTION(oci_lob_write)
        int data_len;
        long write_len = 0; 
        ub4 bytes_written;
-       char *data;
+       zstr data;
+       zend_uchar data_type;
        
        if (getThis()) {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &write_len) == FAILURE) {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t|l", &data, &data_len, &data_type, &write_len) == FAILURE) {
                        return;
                }
                
@@ -515,7 +551,7 @@ PHP_FUNCTION(oci_lob_write)
                }
        }
        else {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &write_len) == FAILURE) {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ot|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &data_type, &write_len) == FAILURE) {
                        return;
                }
 
@@ -534,8 +570,8 @@ PHP_FUNCTION(oci_lob_write)
        if (data_len <= 0) {
                RETURN_LONG(0);
        }
-       
-       if (php_oci_lob_write(descriptor, descriptor->lob_current_position, data, data_len, &bytes_written TSRMLS_CC)) {
+
+       if (php_oci_lob_write(descriptor, descriptor->lob_current_position, data, USTR_BYTES(data_type, data_len), &bytes_written TSRMLS_CC)) {
                RETURN_FALSE;
        }
        RETURN_LONG(bytes_written);
@@ -850,11 +886,13 @@ PHP_FUNCTION(oci_lob_export)
 {      
        zval **tmp, *z_descriptor = getThis();
        php_oci_descriptor *descriptor;
-       char *filename, *buffer;
+       char *filename;
+       zstr buffer;
        int filename_len;
        long start = -1, length = -1, block_length;
        php_stream *stream;
        ub4 lob_length;
+       php_oci_lob_type lob_type;
 
        if (getThis()) {
                if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &filename, &filename_len, &start, &length) == FAILURE) {
@@ -920,19 +958,23 @@ PHP_FUNCTION(oci_lob_export)
                block_length = length;
        }
 
+       if (php_oci_lob_get_type(descriptor, &lob_type TSRMLS_CC)) {
+               RETURN_FALSE;
+       }
+
        while(length > 0) {
                ub4 tmp_bytes_read = 0;
                if (php_oci_lob_read(descriptor, block_length, start, &buffer, &tmp_bytes_read TSRMLS_CC)) {
                        php_stream_close(stream);
                        RETURN_FALSE;
                }
-               if (tmp_bytes_read && !php_stream_write(stream, buffer, tmp_bytes_read)) {
+               if (tmp_bytes_read && !php_stream_u_write(stream, (lob_type == OCI_IS_CLOB ? IS_UNICODE : IS_STRING), buffer, tmp_bytes_read)) {
                        php_stream_close(stream);
-                       efree(buffer);
+                       efree(buffer.v);
                        RETURN_FALSE;
                }
-               if (buffer) {
-                       efree(buffer);
+               if (buffer.v) {
+                       efree(buffer.v);
                }
                
                length -= tmp_bytes_read;
@@ -956,17 +998,18 @@ PHP_FUNCTION(oci_lob_write_temporary)
 {
        zval **tmp, *z_descriptor = getThis();
        php_oci_descriptor *descriptor;
-       char *data;
+       zstr data;
        int data_len;
+       zend_uchar data_type;
        long type = OCI_TEMP_CLOB;
 
        if (getThis()) {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &type) == FAILURE) {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t|l", &data, &data_len, &data_type, &type) == FAILURE) {
                        return;
                }
        }
        else {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &type) == FAILURE) {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ot|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &data_type, &type) == FAILURE) {
                        return;
                }       
        }
@@ -978,7 +1021,7 @@ PHP_FUNCTION(oci_lob_write_temporary)
        
        PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
 
-       if (php_oci_lob_write_tmp(descriptor, type, data, data_len TSRMLS_CC)) {
+       if (php_oci_lob_write_tmp(descriptor, type, data, USTR_BYTES(data_type, data_len) TSRMLS_CC)) {
                RETURN_FALSE;
        }
        RETURN_TRUE;
@@ -1099,7 +1142,7 @@ PHP_FUNCTION(oci_field_name)
        php_oci_out_column *column;
 
        if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) {
-               RETURN_STRINGL(column->name, column->name_len, 1);
+               RETURN_TEXTL(column->name, column->name_len, 1);
        }
        RETURN_FALSE;
 }
@@ -1163,49 +1206,49 @@ PHP_FUNCTION(oci_field_type)
        switch (column->data_type) {
 #ifdef SQLT_TIMESTAMP
                case SQLT_TIMESTAMP:
-                       RETVAL_STRING("TIMESTAMP",1);
+                       RETVAL_ASCII_STRING("TIMESTAMP", ZSTR_DUPLICATE);
                        break;
 #endif
 #ifdef SQLT_TIMESTAMP_TZ
                case SQLT_TIMESTAMP_TZ:
-                       RETVAL_STRING("TIMESTAMP_TZ",1);
+                       RETVAL_ASCII_STRING("TIMESTAMP_TZ", ZSTR_DUPLICATE);
                        break;
 #endif
                case SQLT_DAT:
-                       RETVAL_STRING("DATE",1);
+                       RETVAL_ASCII_STRING("DATE", ZSTR_DUPLICATE);
                        break;
                case SQLT_NUM:
-                       RETVAL_STRING("NUMBER",1);
+                       RETVAL_ASCII_STRING("NUMBER", ZSTR_DUPLICATE);
                        break;
                case SQLT_LNG:
-                       RETVAL_STRING("LONG",1);
+                       RETVAL_ASCII_STRING("LONG", ZSTR_DUPLICATE);
                        break;
                case SQLT_BIN:
-                       RETVAL_STRING("RAW",1);
+                       RETVAL_ASCII_STRING("RAW", ZSTR_DUPLICATE);
                        break;
                case SQLT_LBI:
-                       RETVAL_STRING("LONG RAW",1);
+                       RETVAL_ASCII_STRING("LONG RAW", ZSTR_DUPLICATE);
                        break;
                case SQLT_CHR:
-                       RETVAL_STRING("VARCHAR2",1);
+                       RETVAL_ASCII_STRING("VARCHAR2", ZSTR_DUPLICATE);
                        break;
                case SQLT_RSET:
-                       RETVAL_STRING("REFCURSOR",1);
+                       RETVAL_ASCII_STRING("REFCURSOR", ZSTR_DUPLICATE);
                        break;
                case SQLT_AFC:
-                       RETVAL_STRING("CHAR",1);
+                       RETVAL_ASCII_STRING("CHAR", ZSTR_DUPLICATE);
                        break;
                case SQLT_BLOB:
-                       RETVAL_STRING("BLOB",1);
+                       RETVAL_ASCII_STRING("BLOB", ZSTR_DUPLICATE);
                        break;
                case SQLT_CLOB:
-                       RETVAL_STRING("CLOB",1);
+                       RETVAL_ASCII_STRING("CLOB", ZSTR_DUPLICATE);
                        break;
                case SQLT_BFILE:
-                       RETVAL_STRING("BFILE",1);
+                       RETVAL_ASCII_STRING("BFILE", ZSTR_DUPLICATE);
                        break;
                case SQLT_RDD:
-                       RETVAL_STRING("ROWID",1);
+                       RETVAL_ASCII_STRING("ROWID", ZSTR_DUPLICATE);
                        break;
                default:
                        RETVAL_LONG(column->data_type);
@@ -1356,7 +1399,7 @@ PHP_FUNCTION(oci_fetch_all)
                columns = safe_emalloc(statement->ncolumns, sizeof(php_oci_out_column *), 0);
 
                for (i = 0; i < statement->ncolumns; i++) {
-                       columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+                       columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
                }
 
                while (!php_oci_statement_fetch(statement, nrows TSRMLS_CC)) {
@@ -1372,7 +1415,7 @@ PHP_FUNCTION(oci_fetch_all)
                                if (flags & PHP_OCI_NUM) {
                                        zend_hash_next_index_insert(Z_ARRVAL_P(row), &element, sizeof(zval*), NULL);
                                } else { /* default to ASSOC */
-                                       zend_hash_update(Z_ARRVAL_P(row), columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL);
+                                       zend_u_hash_update(Z_ARRVAL_P(row), (UG(unicode) ? IS_UNICODE : IS_STRING), columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL);
                                }
                        }
 
@@ -1392,7 +1435,7 @@ PHP_FUNCTION(oci_fetch_all)
                
                if (flags & PHP_OCI_NUM) {
                        for (i = 0; i < statement->ncolumns; i++) {
-                               columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+                               columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
                                
                                MAKE_STD_ZVAL(tmp);
                                array_init(tmp);
@@ -1400,11 +1443,11 @@ PHP_FUNCTION(oci_fetch_all)
                        }
                } else { /* default to ASSOC */
                        for (i = 0; i < statement->ncolumns; i++) {
-                               columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+                               columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
                                
                                MAKE_STD_ZVAL(tmp);
                                array_init(tmp);
-                               zend_hash_update(Z_ARRVAL_P(array), columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ]));
+                               zend_u_hash_update(Z_ARRVAL_P(array), (UG(unicode) ? IS_UNICODE : IS_STRING), columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ]));
                        }
                }
 
@@ -1549,7 +1592,7 @@ PHP_FUNCTION(oci_error)
        dvoid *errh = NULL;
 #ifdef HAVE_OCI8_ATTR_STATEMENT
        ub2 error_offset = 0;
-       text *sqltext = NULL;
+       zstr sqltext = NULL_ZSTR;
 #endif
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &arg) == FAILURE) {
@@ -1595,10 +1638,18 @@ PHP_FUNCTION(oci_error)
        if (errcode) {
                array_init(return_value);
                add_assoc_long(return_value, "code", errcode);
-               add_assoc_string(return_value, "message", (char*) errbuf, 0);
+               if (UG(unicode)) {
+                       add_assoc_unicode(return_value, "message", (UChar *)errbuf, 0);
+               } else {
+                       add_assoc_string(return_value, "message", errbuf, 0);
+               }
 #ifdef HAVE_OCI8_ATTR_STATEMENT
                add_assoc_long(return_value, "offset", error_offset);
-               add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : "", 1);
+               if (sqltext.v) {
+                       add_assoc_text(return_value, "sqltext", sqltext, 1);
+               } else {
+                       add_assoc_ascii_string(return_value, "sqltext", "", 1);
+               }
 #endif
        } else {
                RETURN_FALSE;
@@ -1630,16 +1681,17 @@ PHP_FUNCTION(oci_parse)
        zval *z_connection;
        php_oci_connection *connection;
        php_oci_statement *statement;
-       char *query;
+       zstr query;
+       zend_uchar query_type;
        int query_len;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &query, &query_len) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rt", &z_connection, &query, &query_len, &query_type) == FAILURE) {
                return;
        }
 
        PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
 
-       statement = php_oci_statement_create(connection, query, query_len TSRMLS_CC);
+       statement = php_oci_statement_create(connection, query, query_len, query_type TSRMLS_CC);
 
        if (statement) {
                RETURN_RESOURCE(statement->id);
@@ -1674,11 +1726,12 @@ PHP_FUNCTION(oci_set_prefetch)
 PHP_FUNCTION(oci_password_change)
 {
        zval *z_connection;
-       text *user, *pass_old, *pass_new, *dbname;
+       zstr user, pass_old, pass_new, dbname;
+       zend_uchar user_type, pass_old_type, pass_new_type, dbname_type;
        int user_len, pass_old_len, pass_new_len, dbname_len;
        php_oci_connection *connection;
 
-       if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rsss", &z_connection, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) {
+       if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rTTT", &z_connection, &user, &user_len, &user_type, &pass_old, &pass_old_len, &pass_old_type, &pass_new, &pass_new_len, &pass_new_type) == SUCCESS) {
                PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
 
                if (!user_len) {
@@ -1694,11 +1747,11 @@ 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, user, user_len, pass_old, pass_old_len, pass_new, pass_new_len, user_type TSRMLS_CC)) {
                        RETURN_FALSE;
                }
                RETURN_TRUE;
-       } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ssss", &dbname, &dbname_len, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) {
+       } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "TTTT", &dbname, &dbname_len, &dbname_type, &user, &user_len, &user_type, &pass_old, &pass_old_len, &pass_old_type, &pass_new, &pass_new_len, &pass_new_type) == SUCCESS) {
 
                if (!user_len) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "username cannot be empty");
@@ -1713,7 +1766,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(user, user_len, pass_old, pass_old_len, pass_new, pass_new_len, dbname, dbname_len, NULL_ZSTR, OCI_DEFAULT, 0, 0, user_type TSRMLS_CC);
                if (!connection) {
                        RETURN_FALSE;
                }
@@ -1737,7 +1790,7 @@ PHP_FUNCTION(oci_new_cursor)
 
        PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
 
-       statement = php_oci_statement_create(connection, NULL, 0 TSRMLS_CC);
+       statement = php_oci_statement_create(connection, NULL_ZSTR, 0, 0 TSRMLS_CC);
        
        if (statement) {
                RETURN_RESOURCE(statement->id);
@@ -1768,7 +1821,7 @@ PHP_FUNCTION(oci_server_version)
 {
        zval *z_connection;
        php_oci_connection *connection;
-       char *version = NULL;
+       zstr version = NULL_ZSTR;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_connection) == FAILURE) {
                return;
@@ -1780,7 +1833,7 @@ PHP_FUNCTION(oci_server_version)
                RETURN_FALSE;
        }
        
-       RETURN_STRING(version, 0);
+       RETURN_TEXT(version, 0);
 }
 /* }}} */
 
@@ -1889,16 +1942,16 @@ PHP_FUNCTION(oci_collection_append)
 {
        zval **tmp, *z_collection = getThis();
        php_oci_collection *collection;
-       char *value;
+       zstr value;
        int value_len;
+       zend_uchar value_type;
 
        if (getThis()) {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &value, &value_len) == FAILURE) {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &value, &value_len, &value_type) == FAILURE) {
                        return;
                }
-       }
-       else {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os", &z_collection, oci_coll_class_entry_ptr, &value, &value_len) == FAILURE) {
+       } else {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ot", &z_collection, oci_coll_class_entry_ptr, &value, &value_len, &value_type) == FAILURE) {
                        return;
                }       
        }
@@ -2000,15 +2053,15 @@ PHP_FUNCTION(oci_collection_element_assign)
        php_oci_collection *collection;
        int value_len;
        long element_index;
-       char *value;
+       zstr value;
+       zend_uchar value_type;
 
        if (getThis()) {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &element_index, &value, &value_len) == FAILURE) {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lt", &element_index, &value, &value_len, &value_type) == FAILURE) {
                        return;
                }
-       }
-       else {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ols", &z_collection, oci_coll_class_entry_ptr, &element_index, &value, &value_len) == FAILURE) {
+       } else {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Olt", &z_collection, oci_coll_class_entry_ptr, &element_index, &value, &value_len, &value_type) == FAILURE) {
                        return;
                }       
        }
@@ -2123,10 +2176,11 @@ PHP_FUNCTION(oci_new_collection)
        zval *z_connection;
        php_oci_connection *connection;
        php_oci_collection *collection;
-       char *tdo, *schema = NULL;
+       zstr tdo, schema = NULL_ZSTR;
        int tdo_len, schema_len = 0;
+       zend_uchar tdo_type, schema_type;
        
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|s", &z_connection, &tdo, &tdo_len, &schema, &schema_len) == FAILURE) {
+       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;
        }
     
@@ -2135,8 +2189,7 @@ PHP_FUNCTION(oci_new_collection)
        if ( (collection = php_oci_collection_create(connection, tdo, tdo_len, schema, schema_len TSRMLS_CC)) ) {
                object_init_ex(return_value, oci_coll_class_entry_ptr);
                add_property_resource(return_value, "collection", collection->id);
-       }
-       else {
+       } else {
                RETURN_FALSE;
        }
 }
index 39aae293f272b9f42d706964c72c8e58dbcd8e79..64bb35bf07104aa92cd927432b09ddae8384c217 100644 (file)
@@ -156,14 +156,20 @@ sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece)
 {
        ub4 lenp = (ub4) len;
        php_oci_lob_ctx *ctx = (php_oci_lob_ctx *)ctxp;
+       TSRMLS_FETCH();
 
        switch (piece)
        {
                case OCI_LAST_PIECE:
-                       *(ctx->lob_data) = erealloc(*(ctx->lob_data), (size_t) (*(ctx->lob_len) + lenp + 1));
+                       *(ctx->lob_data) = erealloc(*(ctx->lob_data), (size_t) (*(ctx->lob_len) + lenp + TEXT_BYTES(1)));
                        memcpy(*(ctx->lob_data) + *(ctx->lob_len), bufxp, (size_t) lenp);
                        *(ctx->lob_len) += lenp;
-                       *(*(ctx->lob_data) + *(ctx->lob_len)) = 0x00;
+                       
+                       if (UG(unicode)) {
+                               *(*(ctx->lob_data) + *(ctx->lob_len) + 1) = 0;
+                       }
+                       *(*(ctx->lob_data) + *(ctx->lob_len)) = 0;
+                       
                        return OCI_CONTINUE;
 
                case OCI_FIRST_PIECE:
@@ -173,14 +179,12 @@ sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece)
                        *(ctx->lob_len) += lenp;
                        return OCI_CONTINUE;
 
-               default: {
-                       TSRMLS_FETCH();
+               default:
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unexpected LOB piece id received (value:%d)", piece);
                        efree(*(ctx->lob_data));
                        *(ctx->lob_data) = NULL;
                        *(ctx->lob_len) = 0;
                        return OCI_ERROR;
-               }
        }
 }
 /* }}} */
@@ -211,27 +215,27 @@ static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, l
 
 /* {{{ 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, char **data, ub4 *data_len TSRMLS_DC)
+int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long initial_offset, zstr *data, ub4 *data_len TSRMLS_DC)
 {
        php_oci_connection *connection = descriptor->connection;
        ub4 length = 0;
        int buffer_size = PHP_OCI_LOB_BUFFER_SIZE;
        php_oci_lob_ctx ctx;
        ub1 *bufp;
+       php_oci_lob_type lob_type;
 #if defined(HAVE_OCI_LOB_READ2)
        oraub8 bytes_read, offset = 0;
        oraub8 requested_len = read_length; /* this is by default */
        oraub8 chars_read = 0;
-       int is_clob = 0;
 #else
        int bytes_read, offset = 0;
        int requested_len = read_length; /* this is by default */
 #endif
 
        *data_len = 0;
-       *data = NULL;
+       *data = NULL_ZSTR;
        ctx.lob_len = data_len;
-       ctx.lob_data = data;
+       ctx.lob_data = &(data->s);
 
        if (php_oci_lob_get_length(descriptor, &length TSRMLS_CC)) {
                return 1;
@@ -257,7 +261,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
        if (requested_len <= 0) {
                return 0;
        }
-       
+
        offset = initial_offset;
 
        if (descriptor->type == OCI_DTYPE_FILE) {
@@ -269,24 +273,13 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
                        return 1;
                }
        }
-#ifdef HAVE_OCI_LOB_READ2
-       else {
-               ub2 charset_id = 0;
-
-               PHP_OCI_CALL_RETURN(connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id));
-
-               if (connection->errcode != OCI_SUCCESS) {
-                       php_oci_error(connection->err, connection->errcode TSRMLS_CC);
-                       PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
-                       return 1;
-               }
 
-               if (charset_id > 0) { /* charset_id is always > 0 for [N]CLOBs */
-                       is_clob = 1;
-               }
+       if (php_oci_lob_get_type(descriptor, &lob_type TSRMLS_CC) > 0) {
+               return 1;
        }
 
-       if (is_clob) {
+#ifdef HAVE_OCI_LOB_READ2
+       if (lob_type == OCI_IS_CLOB) {
                chars_read = requested_len;
                bytes_read = 0;
        } else {
@@ -318,7 +311,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
        
        efree(bufp);
        
-       if (is_clob) {
+       if (lob_type == OCI_IS_CLOB) {
                offset = descriptor->lob_current_position + chars_read;
        } else {
                offset = descriptor->lob_current_position + bytes_read;
@@ -348,22 +341,26 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
        );
        
        efree(bufp);
-       offset = descriptor->lob_current_position + bytes_read;
+       if (!is_clob) {
+               offset = descriptor->lob_current_position + TEXT_BYTES(bytes_read);
+       } else {
+               offset = descriptor->lob_current_position + bytes_read;
+       }
 
 #endif
        
        if (connection->errcode != OCI_SUCCESS) {
                php_oci_error(connection->err, connection->errcode TSRMLS_CC);
                PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
-               if (*data) {
-                       efree(*data);
-                       *data = NULL;
+               if (data->s) {
+                       efree(data->s);
+                       *data = NULL_ZSTR;
                }
                *data_len = 0;
                return 1;
        }
        
-       descriptor->lob_current_position = (int)offset
+       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));
@@ -371,9 +368,9 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
                if (connection->errcode != OCI_SUCCESS) {
                        php_oci_error(connection->err, connection->errcode TSRMLS_CC);
                        PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
-                       if (*data) {
-                               efree(*data);
-                               *data = NULL;
+                       if (data->s) {
+                               efree(data->s);
+                               *data = NULL_ZSTR;
                        }
                        *data_len = 0;
                        return 1;
@@ -385,18 +382,28 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
 
 /* {{{ php_oci_lob_write() 
  Write data to the LOB */
-int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, int data_len, ub4 *bytes_written TSRMLS_DC)
+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;
        php_oci_connection *connection = (php_oci_connection *) descriptor->connection;
        ub4 lob_length;
+       ub4 data_len_out = data_len;
+       php_oci_lob_type lob_type;
        
        *bytes_written = 0;
        if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
                return 1;
        }
-       
-       if (!data || data_len <= 0) {
+
+       if (php_oci_lob_get_type(descriptor, &lob_type TSRMLS_CC)) {
+               return 1;
+       }
+
+       if (lob_type == OCI_IS_CLOB) {
+               data_len_out = TEXT_CHARS(data_len);
+       }
+
+       if (!data.v || data_len <= 0) {
                return 0;
        }
        
@@ -407,15 +414,15 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i
        if (offset > descriptor->lob_current_position) {
                offset = descriptor->lob_current_position;
        }
-       
+
        PHP_OCI_CALL_RETURN(connection->errcode, OCILobWrite, 
                        (
                                connection->svc, 
                                connection->err, 
                                lob, 
-                               (ub4 *)&data_len, 
+                               (ub4 *)&data_len_out
                                (ub4) offset + 1, 
-                               (dvoid *) data
+                               (dvoid *) (text *)data.s
                                (ub4) data_len, 
                                OCI_ONE_PIECE, 
                                (dvoid *)0, 
@@ -431,8 +438,8 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i
                *bytes_written = 0;
                return 1;
        }
-       *bytes_written = data_len;
-       descriptor->lob_current_position += data_len;
+       *bytes_written = data_len_out;
+       descriptor->lob_current_position += data_len_out;
        
        if (descriptor->lob_current_position > descriptor->lob_size) {
                descriptor->lob_size = descriptor->lob_current_position;
@@ -779,7 +786,7 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, long length,
        if (length == -1) {
                length = lob_length;
        }
-       
+
        PHP_OCI_CALL_RETURN(connection->errcode, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+1));
 
        if (connection->errcode != OCI_SUCCESS) {
@@ -812,7 +819,7 @@ int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descript
 
 /* {{{ 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, char *data, int data_len TSRMLS_DC)
+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;
@@ -829,7 +836,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data,
                        break;
        }
 
-       if (!data || data_len <= 0) {
+       if (!data.v || data_len <= 0) {
                /* nothing to write, silently fail */
                return 1;
        }
@@ -864,4 +871,44 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data,
        return php_oci_lob_write(descriptor, 0, data, data_len, &bytes_written TSRMLS_CC);
 } /* }}} */
 
+int php_oci_lob_get_type(php_oci_descriptor *descriptor, php_oci_lob_type *lob_type TSRMLS_DC) /* {{{ */
+{
+       php_oci_connection *connection = descriptor->connection;
+
+       *lob_type = 0;
+       
+       if (descriptor->lob_type) {
+               *lob_type = descriptor->lob_type;
+               return 0;
+       }
+
+       if (descriptor->type == OCI_DTYPE_FILE) {
+               *lob_type = OCI_IS_BLOB;
+               descriptor->lob_type = OCI_IS_BLOB;
+               return 0;
+       } else {
+               ub2 charset_id = 0;
+
+               PHP_OCI_CALL_RETURN(connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id));
+
+               if (connection->errcode != OCI_SUCCESS) {
+                       php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+                       PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
+                       return 1;
+               }
+
+               if (charset_id > 0) { /* charset_id is always > 0 for [N]CLOBs */
+                       *lob_type = OCI_IS_CLOB;
+                       descriptor->lob_type = OCI_IS_CLOB;
+                       return 0;
+               }
+       }
+
+       *lob_type = OCI_IS_BLOB;
+       descriptor->lob_type = OCI_IS_BLOB;
+
+       return 0;
+}
+/* }}} */
+
 #endif /* HAVE_OCI8 */
index 8c117ea304eb251295b129e00d34f002d4336739..c7c1ff4b21d42e7c9edc71f92dc048d8aca1efb9 100644 (file)
@@ -43,7 +43,7 @@
 
 /* {{{ php_oci_statement_create() 
  Create statemend handle and allocate necessary resources */
-php_oci_statement *php_oci_statement_create (php_oci_connection *connection, char *query, int query_len TSRMLS_DC)
+php_oci_statement *php_oci_statement_create (php_oci_connection *connection, zstr query, int query_len, zend_uchar type TSRMLS_DC)
 {
        php_oci_statement *statement;
        
@@ -67,8 +67,8 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha
                                 connection->svc,
                                 &(statement->stmt),
                                 connection->err,
-                                (text *)query,
-                                query_len,
+                                (text *)query.s,
+                                USTR_BYTES(type, query_len),
                                 NULL,
                                 0,
                                 OCI_NTV_SYNTAX,
@@ -95,8 +95,10 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha
                }
        }
        
-       if (query && query_len) {
-               statement->last_query = estrndup(query, query_len);
+       if (query.s && query_len) {
+               statement->last_query = emalloc(USTR_BYTES(type, query_len + 1));
+               memcpy(statement->last_query, query.s, USTR_BYTES(type, query_len));
+               statement->last_query[USTR_BYTES(type, query_len)] = '\0';
                statement->last_query_len = query_len;
        }
        else {
@@ -161,8 +163,8 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
        ub4 typep, iterp, idxp;
        ub1 in_outp, piecep;
        zend_bool piecewisecols = 0;
-
        php_oci_out_column *column;
+       zstr zstr_data;
 
        PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT));
 
@@ -190,7 +192,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
 
        /* reset length for all piecewise columns */
        for (i = 0; i < statement->ncolumns; i++) {
-               column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+               column = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
                if (column->piecewise) {
                        column->retlen4 = 0;
                        piecewisecols = 1;
@@ -215,12 +217,14 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
 
                        /* scan through our columns for a piecewise column with a matching handle */
                        for (i = 0; i < statement->ncolumns; i++) {
-                               column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
-                               if (column->piecewise && handlepp == column->oci_define)   {
+                               column = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
+                               if (column->piecewise && handlepp == column->oci_define) {
                                        if (!column->data) {
-                                               column->data = (text *) ecalloc(1, PHP_OCI_PIECE_SIZE + 1);
+                                               zstr_data.v = ecalloc(1, PHP_OCI_PIECE_SIZE + 1);
+                                               column->data = zstr_data.v;
                                        } else {
-                                               column->data = erealloc(column->data, column->retlen4 + PHP_OCI_PIECE_SIZE + 1);
+                                               zstr_data.v = erealloc(column->data, column->retlen4 + PHP_OCI_PIECE_SIZE + 1);
+                                               column->data = zstr_data.v;
                                        }
                                        column->cb_retlen = PHP_OCI_PIECE_SIZE;
 
@@ -230,7 +234,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
                                                        (void *) column->oci_define,
                                                        OCI_HTYPE_DEFINE,
                                                        statement->err,
-                                                       ((char*)column->data) + column->retlen4,
+                                                       ((void*)zstr_data.s) + column->retlen4,
                                                        &(column->cb_retlen),
                                                        piecep,
                                                        &column->indicator,
@@ -245,7 +249,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
 
                if (piecewisecols) {
                        for (i = 0; i < statement->ncolumns; i++) {
-                               column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+                               column = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
                                if (column && column->piecewise && handlepp == column->oci_define)      {
                                        column->retlen4 += column->cb_retlen;
                                }
@@ -258,7 +262,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
 
                /* do the stuff needed for OCIDefineByName */
                for (i = 0; i < statement->ncolumns; i++) {
-                       column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+                       column = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
                        if (column == NULL) {
                                continue;
                        }
@@ -285,7 +289,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
 
 /* {{{ 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, char *column_name, int column_name_len TSRMLS_DC)
+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)
 {
        php_oci_out_column *column = NULL;
        int i;
@@ -294,13 +298,17 @@ php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, l
                return NULL;
        }
 
-       if (column_name) {
+       if (column_name.v != NULL) {
                for (i = 0; i < statement->ncolumns; i++) {
-                       column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+                       column = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
                        if (column == NULL) {
                                continue;
-                       } else if (((int) column->name_len == column_name_len) && (!strncmp(column->name, column_name, column_name_len))) {
-                               return column;
+                       } else if ((int) column->name_len == column_name_len) {
+                               if (!UG(unicode) && !strncmp(column->name.s, column_name.s, column_name_len)) {
+                                       return column;
+                               } else if (UG(unicode) && !u_strncmp(column->name.u, column_name.u, column_name_len)) {
+                                       return column;
+                               }
                        }
                }
        } else if (column_index != -1) {
@@ -469,7 +477,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                        }
 
                        outcol->storage_size4 = outcol->data_size;
-                       outcol->retlen = outcol->data_size;
+                       outcol->retlen = TEXT_CHARS(outcol->data_size);
 
                        /* get scale of the column */
                        PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err));
@@ -502,17 +510,22 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                        }
                        PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
 
-                       outcol->name = estrndup((char*) colname, outcol->name_len);
+                       if (UG(unicode)) {
+                               outcol->name_len = TEXT_CHARS(outcol->name_len);
+                               outcol->name.u = eustrndup((UChar*) colname, outcol->name_len);
+                       } else {
+                               outcol->name.s = estrndup((char*) colname, outcol->name_len);
+                       }
 
                        /* find a user-setted define */
                        if (statement->defines) {
-                               zend_hash_find(statement->defines,outcol->name,outcol->name_len,(void **) &outcol->define);
+                               zend_hash_find(statement->defines, outcol->name.s, TEXT_BYTES(outcol->name_len+1), (void **) &outcol->define);
                        }
 
                        buf = 0;
                        switch (outcol->data_type) {
                                case SQLT_RSET:
-                                       outcol->statement = php_oci_statement_create(statement->connection, NULL, 0 TSRMLS_CC);
+                                       outcol->statement = php_oci_statement_create(statement->connection, NULL_ZSTR, 0, 0 TSRMLS_CC);
                                        outcol->stmtid = outcol->statement->id;
                                        outcol->statement->nested = 1;
 
@@ -544,7 +557,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                                        
                                        descr = php_oci_lob_create(statement->connection, dtype TSRMLS_CC);
                                        if (!descr) {
-                                               efree(outcol->name);
+                                               efree(outcol->name.v);
                                                return 1;
                                        }
                                        outcol->descid = descr->id;
@@ -732,6 +745,14 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
        } else if (Z_TYPE_P(bind->zval) == IS_STRING && Z_STRLEN_P(bind->zval) > 0) {
                Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRLEN_P(bind->zval)+1);
                Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] = '\0';
+       } else if (Z_TYPE_P(bind->zval) == IS_UNICODE && Z_UNILEN_P(bind->zval) > 0) {
+               if (bind->out) {
+                       /* OCI returns _bytes_ as data length for OUT binds */
+                       Z_UNILEN_P(bind->zval) = TEXT_CHARS(Z_UNILEN_P(bind->zval));
+               }
+               Z_UNIVAL_P(bind->zval).u = eurealloc(Z_UNIVAL_P(bind->zval).u, Z_UNILEN_P(bind->zval)+1);
+               Z_UNIVAL_P(bind->zval).s[ TEXT_BYTES(Z_UNILEN_P(bind->zval)) - 1 ] = '\0';
+               Z_UNIVAL_P(bind->zval).s[ TEXT_BYTES(Z_UNILEN_P(bind->zval)) ] = '\0';
        } else if (Z_TYPE_P(bind->zval) == IS_ARRAY) {
                int i;
                zval **entry;
@@ -779,16 +800,20 @@ 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);
+                                                       zstr tmp;
+                                                       tmp.s = buff;
+                                                       ZVAL_TEXTL(*entry, tmp, buff_len, 1);
                                                }
                                                zend_hash_move_forward(hash);
                                        } else {
+                                               zstr tmp;
                                                PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
+                                               tmp.s = buff;
                                                if (connection->errcode != OCI_SUCCESS) {
                                                        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_textl(bind->zval, tmp, buff_len, 1);
                                                }
                                        }
                                }
@@ -800,15 +825,20 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
                        case SQLT_AVC:
                        case SQLT_STR:
                        case SQLT_LVC:
-                               for (i = 0; i < bind->array.current_length; i++) {
-                                       /* int curr_element_length = strlen(((text *)bind->array.elements)+i*bind->array.max_length); */
-                                       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);
-                                               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);
+                               {
+                                       zstr tmp;
+                                       for (i = 0; i < bind->array.current_length; i++) {
+                                               /* int curr_element_length = strlen(((text *)bind->array.elements)+i*bind->array.max_length); */
+                                               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);
+                                                       tmp.s = ((text *)bind->array.elements)+i*bind->array.max_length;
+                                                       ZVAL_TEXTL(*entry, tmp, curr_element_length, 1);
+                                                       zend_hash_move_forward(hash);
+                                               } else {
+                                                       tmp.s = ((text *)bind->array.elements)+i*bind->array.max_length;
+                                                       add_next_index_textl(bind->zval, tmp, curr_element_length, 1);
+                                               }
                                        }
                                }
                                break;
@@ -821,7 +851,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
 
 /* {{{ php_oci_bind_by_name() 
  Bind zval to the given placeholder */
-int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long maxlength, long type TSRMLS_DC)
+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)
 {
        php_oci_collection *bind_collection = NULL;
        php_oci_descriptor *bind_descriptor = NULL;
@@ -894,10 +924,20 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
                case SQLT_CHR:
                        /* this is the default case when type was not specified */
                        if (Z_TYPE_P(var) != IS_NULL) {
-                               convert_to_string(var);
+                               convert_to_text(var);
                        }
                        if (maxlength == -1) {
-                               value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRLEN_P(var) : 0;
+                               switch (Z_TYPE_P(var)) {
+                                       case IS_STRING:
+                                               value_sz = Z_STRLEN_P(var);
+                                               break;
+                                       case IS_UNICODE:
+                                               value_sz = Z_UNILEN_P(var);
+                                               break;
+                                       default:
+                                               value_sz = 0;
+                                               break;
+                               }
                        } else {
                                value_sz = maxlength;
                        }
@@ -930,13 +970,13 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
        }
 
        memset((void*)&bind,0,sizeof(php_oci_bind));
-       if (zend_hash_find(statement->binds, name, name_len + 1, (void **)&old_bind) == SUCCESS) {
+       if (zend_hash_find(statement->binds, name.s, USTR_BYTES(uni_type, name_len + 1), (void **)&old_bind) == SUCCESS) {
                bindp = old_bind;
                if (bindp->zval) {
                        zval_ptr_dtor(&bindp->zval);
                }
        } else {
-               zend_hash_update(statement->binds, name, name_len + 1, &bind, sizeof(php_oci_bind), (void **)&bindp);
+               zend_hash_update(statement->binds, name.s, USTR_BYTES(uni_type, name_len + 1), &bind, sizeof(php_oci_bind), (void **)&bindp);
        }
        
        bindp->descriptor = oci_desc;
@@ -951,10 +991,10 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
                        statement->stmt,                /* statement handle */
                        (OCIBind **)&bindp->bind,       /* bind hdl (will alloc) */
                        statement->err,               /* error handle */
-                       (text*) name,                    /* placeholder name */                                   
-                       name_len,                        /* placeholder length */
+                       (text*) name.s,                    /* placeholder name */                                         
+                       USTR_BYTES(uni_type, name_len),                        /* placeholder length */
                        (dvoid *)bind_data,              /* in/out data */
-                       value_sz, /* PHP_OCI_MAX_DATA_SIZE, */ /* max size of input/output 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) */
@@ -1045,10 +1085,15 @@ sb4 php_oci_bind_in_callback(
                *indpp = (dvoid *)&phpbind->indicator;
        } else  if ((phpbind->descriptor == 0) && (phpbind->statement == 0)) {
                /* "normal string bind */
-               convert_to_string(val); 
+               convert_to_text(val); 
 
-               *bufpp = Z_STRVAL_P(val);
-               *alenp = Z_STRLEN_P(val);
+               if (UG(unicode)) {
+                       *bufpp = Z_UNIVAL_P(val).v;
+                       *alenp = UBYTES(Z_UNILEN_P(val));
+               } else {
+                       *bufpp = Z_STRVAL_P(val);
+                       *alenp = Z_STRLEN_P(val);
+               }
                *indpp = (dvoid *)&phpbind->indicator;
        } else if (phpbind->statement != 0) {
                /* RSET */
@@ -1089,25 +1134,41 @@ sb4 php_oci_bind_out_callback(
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid phpbind pointer value");
                return retval;
        }
+       
+       phpbind->out = 1; /* mark as OUT bind */
 
        if ((Z_TYPE_P(val) == IS_OBJECT) || (Z_TYPE_P(val) == IS_RESOURCE)) {
                retval = OCI_CONTINUE;
-       } else {
-               convert_to_string(val);
-               zval_dtor(val);
-               
-               Z_STRLEN_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */
-               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); 
-               *bufpp = Z_STRVAL_P(phpbind->zval);
-               *piecep = OCI_ONE_PIECE;
-               *rcodepp = &phpbind->retcode;
-               *indpp = &phpbind->indicator;
-               retval = OCI_CONTINUE;
+       } else { 
+               if (UG(unicode)) {
+                       convert_to_unicode(val);
+                       zval_dtor(val);
+
+                       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); 
+                       *bufpp = Z_UNIVAL_P(phpbind->zval).v;
+                       *piecep = OCI_ONE_PIECE;
+                       *rcodepp = &phpbind->retcode;
+                       *indpp = &phpbind->indicator;
+                       retval = OCI_CONTINUE;
+               } else { 
+                       convert_to_string(val);
+                       zval_dtor(val);
+
+                       Z_STRLEN_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */
+                       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); 
+                       *bufpp = Z_STRVAL_P(phpbind->zval);
+                       *piecep = OCI_ONE_PIECE;
+                       *rcodepp = &phpbind->retcode;
+                       *indpp = &phpbind->indicator;
+                       retval = OCI_CONTINUE;
+               }
        }
-
        return retval;
 }
 /* }}} */
@@ -1134,15 +1195,15 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME
                return NULL;
        }
        
-       if (Z_TYPE_PP(column_index) == IS_STRING) {
-               column = php_oci_statement_get_column(statement, -1, Z_STRVAL_PP(column_index), Z_STRLEN_PP(column_index) TSRMLS_CC);
+       if (Z_TYPE_PP(column_index) == IS_STRING || Z_TYPE_PP(column_index) == IS_UNICODE) {
+               column = php_oci_statement_get_column(statement, -1, Z_UNIVAL_PP(column_index), Z_UNILEN_PP(column_index) TSRMLS_CC);
                if (!column) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column name \"%s\"", Z_STRVAL_PP(column_index));
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column name \"%v\"", Z_UNIVAL_PP(column_index));
                        return NULL;
                }
        } else {
                convert_to_long_ex(column_index);
-               column = php_oci_statement_get_column(statement, Z_LVAL_PP(column_index), NULL, 0 TSRMLS_CC);
+               column = php_oci_statement_get_column(statement, Z_LVAL_PP(column_index), NULL_ZSTR, 0 TSRMLS_CC);
                if (!column) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%ld\"", Z_LVAL_PP(column_index));
                        return NULL;
@@ -1195,7 +1256,7 @@ int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSR
 
 /* {{{ php_oci_bind_array_by_name() 
  Bind arrays to PL/SQL types */
-int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long max_table_length, long maxlength, long type TSRMLS_DC)
+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)
 {
        php_oci_bind *bind, *bindp;
 
@@ -1248,7 +1309,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam
                zend_hash_init(statement->binds, 13, NULL, php_oci_bind_hash_dtor, 0);
        }
 
-       zend_hash_update(statement->binds, name, name_len + 1, bind, sizeof(php_oci_bind), (void **)&bindp);
+       zend_hash_update(statement->binds, name.s, USTR_BYTES(uni_type, name_len + 1), bind, sizeof(php_oci_bind), (void **)&bindp);
 
        bindp->descriptor = NULL;
        bindp->statement = NULL;
@@ -1264,10 +1325,10 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam
                                                                statement->stmt,
                                                                (OCIBind **)&bindp->bind,
                                                                statement->err,
-                                                               (text *)name,
-                                                               name_len,
+                                                               (text *)name.s,
+                                                               USTR_BYTES(uni_type, name_len),
                                                                (dvoid *) bindp->array.elements, 
-                                                               (sb4) bind->array.max_length,
+                                                               (sb4) USTR_BYTES(uni_type, bind->array.max_length),
                                                                type,
                                                                (dvoid *)0, /* bindp->array.indicators, */
                                                                (ub2 *)bind->array.element_lengths,
@@ -1303,9 +1364,9 @@ php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length,
        if (maxlength == -1) {
                zend_hash_internal_pointer_reset(hash);
                while (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) {
-                       convert_to_string_ex(entry);
-                       if (Z_STRLEN_PP(entry) > maxlength) {
-                               maxlength = Z_STRLEN_PP(entry) + 1;
+                       convert_to_text_ex(entry);
+                       if (Z_UNILEN_PP(entry) > maxlength) {
+                               maxlength = Z_UNILEN_PP(entry) + 1;
                        }
                        zend_hash_move_forward(hash);
                }
@@ -1322,8 +1383,8 @@ 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_string_ex(entry);
-                       bind->array.element_lengths[i] = Z_STRLEN_PP(entry); 
+                       convert_to_text_ex(entry);
+                       bind->array.element_lengths[i] = Z_UNILEN_PP(entry); 
                        zend_hash_move_forward(hash);
                } else {
                        break;
@@ -1335,10 +1396,10 @@ php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length,
                if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
                        int element_length; 
                        
-                       convert_to_string_ex(entry);
-                       element_length = (maxlength > Z_STRLEN_PP(entry)) ? Z_STRLEN_PP(entry) : maxlength;
+                       convert_to_text_ex(entry);
+                       element_length = (maxlength > Z_UNILEN_PP(entry)) ? Z_UNILEN_PP(entry) : maxlength;
                        
-                       memcpy((text *)bind->array.elements + i*maxlength, Z_STRVAL_PP(entry), element_length);
+                       memcpy((text *)bind->array.elements + i*maxlength, Z_UNIVAL_PP(entry).s, element_length);
                        ((text *)bind->array.elements)[i*maxlength + element_length] = '\0';
                        
                        zend_hash_move_forward(hash);
index 22d7f8c37ae53e5bbc2cb20471572c2394b16098..7181574e36b1232d9fcb34f43c86b04bb43334b7 100644 (file)
@@ -97,6 +97,11 @@ extern zend_class_entry *oci_coll_class_entry_ptr;
 
 /* }}} */
 
+typedef enum {
+       OCI_IS_CLOB=1,
+       OCI_IS_BLOB
+} php_oci_lob_type;
+
 typedef struct { /* php_oci_connection {{{ */
        OCIEnv *env;            /* private env handle */
        ub2 charset;            /* charset ID */
@@ -116,19 +121,21 @@ typedef struct { /* php_oci_connection {{{ */
        time_t idle_expiry;                     /* time when the connection will be considered as expired */
        time_t next_ping;                       /* time of the next ping */
        char *hash_key;                         /* hashed details of the connection */
+       int   hash_key_len;     
 } php_oci_connection; /* }}} */
 
 typedef struct { /* php_oci_descriptor {{{ */
        int id;
        php_oci_connection *connection; /* parent connection handle */
        dvoid *descriptor;                              /* OCI descriptor handle */
-       ub4 type;                                               /* descriptor type */
+       ub4 type;                                               /* descriptor type (FILE/LOB) */
        int lob_current_position;               /* LOB internal pointer */ 
        int lob_size;                                   /* cached LOB size. -1 = Lob wasn't initialized yet */
        int buffering;                                  /* cached buffering flag. 0 - off, 1 - on, 2 - on and buffer was used */
        ub4 chunk_size;                                 /* chunk size of the LOB. 0 - unknown */
        ub1 charset_form;                               /* charset form, required for NCLOBs */
        ub2 charset_id;                                 /* charset ID */
+       php_oci_lob_type lob_type;              /* CLOB/BLOB */
 } php_oci_descriptor; /* }}} */
 
 typedef struct { /* php_oci_lob_ctx {{{ */
@@ -149,7 +156,8 @@ typedef struct { /* php_oci_collection {{{ */
 
 typedef struct { /* php_oci_define {{{ */
        zval *zval;             /* zval used in define */
-       text *name;             /* placeholder's name */
+       zstr name;              /* placeholder's name */
+       zend_uchar name_type;           /* unicode or not */
        ub4 name_len;   /* placeholder's name length */
        ub4 type;               /* define type */
 } php_oci_define; /* }}} */
@@ -190,12 +198,13 @@ typedef struct { /* php_oci_bind {{{ */
        } array;
        sb2 indicator;                  /* -1 means NULL */
        ub2 retcode;                    /*  */
+       zend_bool out;                  /* OUT bind or not */
 } php_oci_bind; /* }}} */
 
 typedef struct { /* php_oci_out_column {{{ */
        php_oci_statement *statement;   /* statement handle. used when fetching REFCURSORS */
        OCIDefine *oci_define;                  /* define handle */
-       char *name;                                             /* column name */
+       zstr name;                                              /* column name */
        ub4 name_len;                                   /* column name length */
        ub2 data_type;                                  /* column data type */
        ub2 data_size;                                  /* data size */
@@ -302,17 +311,17 @@ int php_oci_descriptor_delete_from_hash(void *data, void *id TSRMLS_DC);
 sb4 php_oci_error (OCIError *, sword TSRMLS_DC);
 sb4 php_oci_fetch_errmsg(OCIError *, text ** TSRMLS_DC);
 #ifdef HAVE_OCI8_ATTR_STATEMENT
-int php_oci_fetch_sqltext_offset(php_oci_statement *, text **, ub2 * TSRMLS_DC);
+int php_oci_fetch_sqltext_offset(php_oci_statement *, zstr *, ub2 * TSRMLS_DC);
 #endif
        
 void php_oci_do_connect (INTERNAL_FUNCTION_PARAMETERS, int , int);
-php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, long session_mode, int persistent, int exclusive TSRMLS_DC);
+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);
 
 int php_oci_connection_rollback(php_oci_connection * TSRMLS_DC);
 int php_oci_connection_commit(php_oci_connection * TSRMLS_DC);
 
-int php_oci_password_change(php_oci_connection *, char *, int, char *, int, char *, int TSRMLS_DC);
-int php_oci_server_get_version(php_oci_connection *, char ** TSRMLS_DC); 
+int php_oci_password_change(php_oci_connection *, zstr, int, zstr, int, zstr, int, zend_uchar TSRMLS_DC);
+int php_oci_server_get_version(php_oci_connection *, zstr* TSRMLS_DC); 
 
 void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int, int);
 int php_oci_column_to_zval(php_oci_out_column *, zval *, int TSRMLS_DC);
@@ -323,15 +332,16 @@ int php_oci_column_to_zval(php_oci_out_column *, zval *, int TSRMLS_DC);
 
 php_oci_descriptor * php_oci_lob_create (php_oci_connection *, long TSRMLS_DC);
 int php_oci_lob_get_length (php_oci_descriptor *, ub4 * TSRMLS_DC);
-int php_oci_lob_read (php_oci_descriptor *, long, long, char **, ub4 * TSRMLS_DC);
-int php_oci_lob_write (php_oci_descriptor *, ub4, char *, int, ub4 * TSRMLS_DC);
+int php_oci_lob_get_type(php_oci_descriptor *descriptor, php_oci_lob_type *lob_type TSRMLS_DC);
+int php_oci_lob_read (php_oci_descriptor *, long, long, zstr *, ub4 * TSRMLS_DC);
+int php_oci_lob_write (php_oci_descriptor *, ub4, zstr, int, ub4 * TSRMLS_DC);
 int php_oci_lob_flush (php_oci_descriptor *, int TSRMLS_DC);
 int php_oci_lob_set_buffering (php_oci_descriptor *, int TSRMLS_DC);
 int php_oci_lob_get_buffering (php_oci_descriptor *);
 int php_oci_lob_copy (php_oci_descriptor *, php_oci_descriptor *, long TSRMLS_DC);
 #ifdef HAVE_OCI8_TEMP_LOB
 int php_oci_lob_close (php_oci_descriptor * TSRMLS_DC);
-int php_oci_lob_write_tmp (php_oci_descriptor *, ub1, char *, int TSRMLS_DC);
+int php_oci_lob_write_tmp (php_oci_descriptor *, ub1, zstr, int TSRMLS_DC);
 #endif
 void php_oci_lob_free(php_oci_descriptor * TSRMLS_DC);
 int php_oci_lob_import(php_oci_descriptor *descriptor, char * TSRMLS_DC);
@@ -344,51 +354,50 @@ sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece
 #else
 sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece);
 #endif
-
 /* }}} */
 
 /* collection related prototypes {{{ */
 
-php_oci_collection * php_oci_collection_create(php_oci_connection *, char *, int, char *, int TSRMLS_DC);
+php_oci_collection * php_oci_collection_create(php_oci_connection *, zstr, int, zstr, int TSRMLS_DC);
 int php_oci_collection_size(php_oci_collection *, sb4 * TSRMLS_DC);
 int php_oci_collection_max(php_oci_collection *, long * TSRMLS_DC);
 int php_oci_collection_trim(php_oci_collection *, long TSRMLS_DC);
-int php_oci_collection_append(php_oci_collection *, char *, int TSRMLS_DC);
+int php_oci_collection_append(php_oci_collection *, zstr, int TSRMLS_DC);
 int php_oci_collection_element_get(php_oci_collection *, long, zval** TSRMLS_DC);
-int php_oci_collection_element_set(php_oci_collection *, long, char*, int TSRMLS_DC);
+int php_oci_collection_element_set(php_oci_collection *, long, zstr, int TSRMLS_DC);
 int php_oci_collection_element_set_null(php_oci_collection *, long TSRMLS_DC);
-int php_oci_collection_element_set_date(php_oci_collection *, long, char *, int TSRMLS_DC);
-int php_oci_collection_element_set_number(php_oci_collection *, long, char *, int TSRMLS_DC);
-int php_oci_collection_element_set_string(php_oci_collection *, long, char *, int TSRMLS_DC);
+int php_oci_collection_element_set_date(php_oci_collection *, long, zstr, int TSRMLS_DC);
+int php_oci_collection_element_set_number(php_oci_collection *, long, zstr, int TSRMLS_DC);
+int php_oci_collection_element_set_string(php_oci_collection *, long, zstr, int TSRMLS_DC);
 int php_oci_collection_assign(php_oci_collection *, php_oci_collection * TSRMLS_DC);
 void php_oci_collection_close(php_oci_collection * TSRMLS_DC);
 int php_oci_collection_append_null(php_oci_collection * TSRMLS_DC);
-int php_oci_collection_append_date(php_oci_collection *, char *, int TSRMLS_DC);
-int php_oci_collection_append_number(php_oci_collection *, char *, int TSRMLS_DC);
-int php_oci_collection_append_string(php_oci_collection *, char *, int TSRMLS_DC);
+int php_oci_collection_append_date(php_oci_collection *, zstr, int TSRMLS_DC);
+int php_oci_collection_append_number(php_oci_collection *, zstr, int TSRMLS_DC);
+int php_oci_collection_append_string(php_oci_collection *, zstr, int TSRMLS_DC);
 
 
 /* }}} */
 
 /* statement related prototypes {{{ */
 
-php_oci_statement * php_oci_statement_create (php_oci_connection *, char *, int TSRMLS_DC);
+php_oci_statement * php_oci_statement_create (php_oci_connection *, zstr, int, zend_uchar TSRMLS_DC);
 int php_oci_statement_set_prefetch (php_oci_statement *, ub4 TSRMLS_DC);
 int php_oci_statement_fetch (php_oci_statement *, ub4 TSRMLS_DC);
-php_oci_out_column * php_oci_statement_get_column (php_oci_statement *, long, char*, int TSRMLS_DC);
+php_oci_out_column * php_oci_statement_get_column (php_oci_statement *, long, zstr, int TSRMLS_DC);
 int php_oci_statement_execute (php_oci_statement *, ub4 TSRMLS_DC);
 int php_oci_statement_cancel (php_oci_statement * TSRMLS_DC);
 void php_oci_statement_free (php_oci_statement * TSRMLS_DC);
 int php_oci_bind_pre_exec(void *data TSRMLS_DC);
 int php_oci_bind_post_exec(void *data TSRMLS_DC);
-int php_oci_bind_by_name(php_oci_statement *, char *, int, zval*, long, long TSRMLS_DC);
+int php_oci_bind_by_name(php_oci_statement *, zstr, int, zval*, long, long, zend_uchar TSRMLS_DC);
 sb4 php_oci_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, ub1 *, dvoid **);
 sb4 php_oci_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **);
 php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data);
 
 int php_oci_statement_get_type(php_oci_statement *, ub2 * TSRMLS_DC);
 int php_oci_statement_get_numrows(php_oci_statement *, ub4 * TSRMLS_DC);
-int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long max_table_length, long maxlength, long type TSRMLS_DC);
+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);
 php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length TSRMLS_DC);
 php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length TSRMLS_DC);
 php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, long maxlength TSRMLS_DC);
index 15278532eac41c5a253c043b8e083fcb78ed15ea..4dfb7ffcf0b261d79506c5775d899405643f4ba6 100644 (file)
@@ -73,3 +73,18 @@ array(5) {
   string(0) ""
 }
 Done
+--UEXPECTF--
+Warning: oci_execute(): ORA-01405: fetched column value is NULL in %s on line %d
+array(5) {
+  [0]=>
+  unicode(0) ""
+  [1]=>
+  unicode(0) ""
+  [2]=>
+  unicode(0) ""
+  [3]=>
+  unicode(0) ""
+  [4]=>
+  unicode(0) ""
+}
+Done
index c44304c11cf957ecebb282a01c75ef14705b8b50..e73e04d7050443990cbf2655da7fccc23e32e801 100644 (file)
@@ -76,3 +76,21 @@ array(5) {
   string(1) "5"
 }
 Done
+--UEXPECTF--
+Warning: oci_execute(): ORA-06550: line 1, column 28:
+PLS-00418: array bind type must match PL/SQL table row type
+ORA-06550: line 1, column 7:
+PL/SQL: Statement ignored in %s on line %d
+array(5) {
+  [0]=>
+  unicode(1) "1"
+  [1]=>
+  unicode(1) "2"
+  [2]=>
+  unicode(1) "3"
+  [3]=>
+  unicode(1) "4"
+  [4]=>
+  unicode(1) "5"
+}
+Done
index a77ed913ea6784e7d0797ff979ff6aad572fdf9f..e0af6add4e870d0c6dd11813002e70ed01a89203 100644 (file)
@@ -1,5 +1,5 @@
 --TEST--
-oci_bind_array_by_name() and invalid values 8
+oci_bind_array_by_name() and invalid values 10
 --SKIPIF--
 <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
 --FILE--
@@ -34,3 +34,18 @@ array(5) {
   string(1) "5"
 }
 Done
+--UEXPECTF--
+Warning: oci_bind_array_by_name(): ORA-01036: illegal variable name/number in %s on line %d
+array(5) {
+  [0]=>
+  unicode(1) "1"
+  [1]=>
+  unicode(1) "2"
+  [2]=>
+  unicode(1) "3"
+  [3]=>
+  unicode(1) "4"
+  [4]=>
+  unicode(1) "5"
+}
+Done
index c9e9c58d687f461c0e7db9cbefe26ccf50d19f1f..199c62ebc9767876addec6fdfe04f378a7530646 100644 (file)
@@ -23,7 +23,7 @@ $stmt = oci_parse($c, "SELECT filetxt FROM phptestlng");
 oci_execute($stmt);
 
 $row = oci_fetch_row($stmt);
-var_dump(md5($row[0]));
+var_dump(md5((binary)$row[0]));
 var_dump(strlen($row[0]));
 
 $stmt = oci_parse($c, "drop table phptestlng");
index e4a8d6e297eb5394a8f1a450a6241384e5ce06b0..2e0e0426c148ee6983378772a74877ce105a81d4 100644 (file)
@@ -23,7 +23,7 @@ $stmt = oci_parse($c, "SELECT fileimage FROM phptestlngraw");
 oci_execute($stmt);
 
 $row = oci_fetch_row($stmt);
-var_dump(md5($row[0]));
+var_dump(md5((binary)$row[0]));
 var_dump(strlen($row[0]));
 
 $stmt = oci_parse($c, "drop table phptestlngraw");
index 7391a22528bde7353ffcc111a95eace78167bed2..163b529860a9d0e1b72eb739259bba075ec5fce0 100644 (file)
@@ -24,7 +24,7 @@ $stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
 oci_execute($stmt);
 
 $row = oci_fetch_row($stmt);
-var_dump(md5($row[0]));
+var_dump(md5((binary)$row[0]));
 var_dump(strlen($row[0]));
 
 $stmt = oci_parse($c, "drop table phptestrawtable");
index 191cdffe6773e1d01094bbc036ec0d097704f32b..ff1ac53a283b9b67092672238892dcbd1e02fcda 100644 (file)
@@ -250,3 +250,204 @@ string(3) "197"
 string(3) "198"
 string(3) "199"
 Done
+--UEXPECTF--
+unicode(1) "1"
+unicode(1) "2"
+unicode(1) "3"
+unicode(1) "4"
+unicode(1) "5"
+unicode(1) "6"
+unicode(1) "7"
+unicode(1) "8"
+unicode(1) "9"
+unicode(2) "10"
+unicode(2) "11"
+unicode(2) "12"
+unicode(2) "13"
+unicode(2) "14"
+unicode(2) "15"
+unicode(2) "16"
+unicode(2) "17"
+unicode(2) "18"
+unicode(2) "19"
+unicode(2) "20"
+unicode(2) "21"
+unicode(2) "22"
+unicode(2) "23"
+unicode(2) "24"
+unicode(2) "25"
+unicode(2) "26"
+unicode(2) "27"
+unicode(2) "28"
+unicode(2) "29"
+unicode(2) "30"
+unicode(2) "31"
+unicode(2) "32"
+unicode(2) "33"
+unicode(2) "34"
+unicode(2) "35"
+unicode(2) "36"
+unicode(2) "37"
+unicode(2) "38"
+unicode(2) "39"
+unicode(2) "40"
+unicode(2) "41"
+unicode(2) "42"
+unicode(2) "43"
+unicode(2) "44"
+unicode(2) "45"
+unicode(2) "46"
+unicode(2) "47"
+unicode(2) "48"
+unicode(2) "49"
+unicode(2) "50"
+unicode(2) "51"
+unicode(2) "52"
+unicode(2) "53"
+unicode(2) "54"
+unicode(2) "55"
+unicode(2) "56"
+unicode(2) "57"
+unicode(2) "58"
+unicode(2) "59"
+unicode(2) "60"
+unicode(2) "61"
+unicode(2) "62"
+unicode(2) "63"
+unicode(2) "64"
+unicode(2) "65"
+unicode(2) "66"
+unicode(2) "67"
+unicode(2) "68"
+unicode(2) "69"
+unicode(2) "70"
+unicode(2) "71"
+unicode(2) "72"
+unicode(2) "73"
+unicode(2) "74"
+unicode(2) "75"
+unicode(2) "76"
+unicode(2) "77"
+unicode(2) "78"
+unicode(2) "79"
+unicode(2) "80"
+unicode(2) "81"
+unicode(2) "82"
+unicode(2) "83"
+unicode(2) "84"
+unicode(2) "85"
+unicode(2) "86"
+unicode(2) "87"
+unicode(2) "88"
+unicode(2) "89"
+unicode(2) "90"
+unicode(2) "91"
+unicode(2) "92"
+unicode(2) "93"
+unicode(2) "94"
+unicode(2) "95"
+unicode(2) "96"
+unicode(2) "97"
+unicode(2) "98"
+unicode(2) "99"
+unicode(3) "100"
+unicode(3) "101"
+unicode(3) "102"
+unicode(3) "103"
+unicode(3) "104"
+unicode(3) "105"
+unicode(3) "106"
+unicode(3) "107"
+unicode(3) "108"
+unicode(3) "109"
+unicode(3) "110"
+unicode(3) "111"
+unicode(3) "112"
+unicode(3) "113"
+unicode(3) "114"
+unicode(3) "115"
+unicode(3) "116"
+unicode(3) "117"
+unicode(3) "118"
+unicode(3) "119"
+unicode(3) "120"
+unicode(3) "121"
+unicode(3) "122"
+unicode(3) "123"
+unicode(3) "124"
+unicode(3) "125"
+unicode(3) "126"
+unicode(3) "127"
+unicode(3) "128"
+unicode(3) "129"
+unicode(3) "130"
+unicode(3) "131"
+unicode(3) "132"
+unicode(3) "133"
+unicode(3) "134"
+unicode(3) "135"
+unicode(3) "136"
+unicode(3) "137"
+unicode(3) "138"
+unicode(3) "139"
+unicode(3) "140"
+unicode(3) "141"
+unicode(3) "142"
+unicode(3) "143"
+unicode(3) "144"
+unicode(3) "145"
+unicode(3) "146"
+unicode(3) "147"
+unicode(3) "148"
+unicode(3) "149"
+unicode(3) "150"
+unicode(3) "151"
+unicode(3) "152"
+unicode(3) "153"
+unicode(3) "154"
+unicode(3) "155"
+unicode(3) "156"
+unicode(3) "157"
+unicode(3) "158"
+unicode(3) "159"
+unicode(3) "160"
+unicode(3) "161"
+unicode(3) "162"
+unicode(3) "163"
+unicode(3) "164"
+unicode(3) "165"
+unicode(3) "166"
+unicode(3) "167"
+unicode(3) "168"
+unicode(3) "169"
+unicode(3) "170"
+unicode(3) "171"
+unicode(3) "172"
+unicode(3) "173"
+unicode(3) "174"
+unicode(3) "175"
+unicode(3) "176"
+unicode(3) "177"
+unicode(3) "178"
+unicode(3) "179"
+unicode(3) "180"
+unicode(3) "181"
+unicode(3) "182"
+unicode(3) "183"
+unicode(3) "184"
+unicode(3) "185"
+unicode(3) "186"
+unicode(3) "187"
+unicode(3) "188"
+unicode(3) "189"
+unicode(3) "190"
+unicode(3) "191"
+unicode(3) "192"
+unicode(3) "193"
+unicode(3) "194"
+unicode(3) "195"
+unicode(3) "196"
+unicode(3) "197"
+unicode(3) "198"
+unicode(3) "199"
+Done
index 67f3552f13bd74a339b37cf156353c4d28ce86ec..b0f72e9ad388f00b97df528a7657fc3cd25fc95b 100644 (file)
@@ -250,3 +250,204 @@ string(3) "197"
 string(3) "198"
 string(3) "199"
 Done
+--UEXPECTF--
+unicode(1) "1"
+unicode(1) "2"
+unicode(1) "3"
+unicode(1) "4"
+unicode(1) "5"
+unicode(1) "6"
+unicode(1) "7"
+unicode(1) "8"
+unicode(1) "9"
+unicode(2) "10"
+unicode(2) "11"
+unicode(2) "12"
+unicode(2) "13"
+unicode(2) "14"
+unicode(2) "15"
+unicode(2) "16"
+unicode(2) "17"
+unicode(2) "18"
+unicode(2) "19"
+unicode(2) "20"
+unicode(2) "21"
+unicode(2) "22"
+unicode(2) "23"
+unicode(2) "24"
+unicode(2) "25"
+unicode(2) "26"
+unicode(2) "27"
+unicode(2) "28"
+unicode(2) "29"
+unicode(2) "30"
+unicode(2) "31"
+unicode(2) "32"
+unicode(2) "33"
+unicode(2) "34"
+unicode(2) "35"
+unicode(2) "36"
+unicode(2) "37"
+unicode(2) "38"
+unicode(2) "39"
+unicode(2) "40"
+unicode(2) "41"
+unicode(2) "42"
+unicode(2) "43"
+unicode(2) "44"
+unicode(2) "45"
+unicode(2) "46"
+unicode(2) "47"
+unicode(2) "48"
+unicode(2) "49"
+unicode(2) "50"
+unicode(2) "51"
+unicode(2) "52"
+unicode(2) "53"
+unicode(2) "54"
+unicode(2) "55"
+unicode(2) "56"
+unicode(2) "57"
+unicode(2) "58"
+unicode(2) "59"
+unicode(2) "60"
+unicode(2) "61"
+unicode(2) "62"
+unicode(2) "63"
+unicode(2) "64"
+unicode(2) "65"
+unicode(2) "66"
+unicode(2) "67"
+unicode(2) "68"
+unicode(2) "69"
+unicode(2) "70"
+unicode(2) "71"
+unicode(2) "72"
+unicode(2) "73"
+unicode(2) "74"
+unicode(2) "75"
+unicode(2) "76"
+unicode(2) "77"
+unicode(2) "78"
+unicode(2) "79"
+unicode(2) "80"
+unicode(2) "81"
+unicode(2) "82"
+unicode(2) "83"
+unicode(2) "84"
+unicode(2) "85"
+unicode(2) "86"
+unicode(2) "87"
+unicode(2) "88"
+unicode(2) "89"
+unicode(2) "90"
+unicode(2) "91"
+unicode(2) "92"
+unicode(2) "93"
+unicode(2) "94"
+unicode(2) "95"
+unicode(2) "96"
+unicode(2) "97"
+unicode(2) "98"
+unicode(2) "99"
+unicode(3) "100"
+unicode(3) "101"
+unicode(3) "102"
+unicode(3) "103"
+unicode(3) "104"
+unicode(3) "105"
+unicode(3) "106"
+unicode(3) "107"
+unicode(3) "108"
+unicode(3) "109"
+unicode(3) "110"
+unicode(3) "111"
+unicode(3) "112"
+unicode(3) "113"
+unicode(3) "114"
+unicode(3) "115"
+unicode(3) "116"
+unicode(3) "117"
+unicode(3) "118"
+unicode(3) "119"
+unicode(3) "120"
+unicode(3) "121"
+unicode(3) "122"
+unicode(3) "123"
+unicode(3) "124"
+unicode(3) "125"
+unicode(3) "126"
+unicode(3) "127"
+unicode(3) "128"
+unicode(3) "129"
+unicode(3) "130"
+unicode(3) "131"
+unicode(3) "132"
+unicode(3) "133"
+unicode(3) "134"
+unicode(3) "135"
+unicode(3) "136"
+unicode(3) "137"
+unicode(3) "138"
+unicode(3) "139"
+unicode(3) "140"
+unicode(3) "141"
+unicode(3) "142"
+unicode(3) "143"
+unicode(3) "144"
+unicode(3) "145"
+unicode(3) "146"
+unicode(3) "147"
+unicode(3) "148"
+unicode(3) "149"
+unicode(3) "150"
+unicode(3) "151"
+unicode(3) "152"
+unicode(3) "153"
+unicode(3) "154"
+unicode(3) "155"
+unicode(3) "156"
+unicode(3) "157"
+unicode(3) "158"
+unicode(3) "159"
+unicode(3) "160"
+unicode(3) "161"
+unicode(3) "162"
+unicode(3) "163"
+unicode(3) "164"
+unicode(3) "165"
+unicode(3) "166"
+unicode(3) "167"
+unicode(3) "168"
+unicode(3) "169"
+unicode(3) "170"
+unicode(3) "171"
+unicode(3) "172"
+unicode(3) "173"
+unicode(3) "174"
+unicode(3) "175"
+unicode(3) "176"
+unicode(3) "177"
+unicode(3) "178"
+unicode(3) "179"
+unicode(3) "180"
+unicode(3) "181"
+unicode(3) "182"
+unicode(3) "183"
+unicode(3) "184"
+unicode(3) "185"
+unicode(3) "186"
+unicode(3) "187"
+unicode(3) "188"
+unicode(3) "189"
+unicode(3) "190"
+unicode(3) "191"
+unicode(3) "192"
+unicode(3) "193"
+unicode(3) "194"
+unicode(3) "195"
+unicode(3) "196"
+unicode(3) "197"
+unicode(3) "198"
+unicode(3) "199"
+Done
index 8ba4ef44b4a625fcc1d0606719e0d0ddb853779c..311dea7ccaa0d445817427f60c9fa18ca0fd19ba 100644 (file)
@@ -250,3 +250,204 @@ string(3) "197"
 string(3) "198"
 string(3) "199"
 Done
+--UEXPECTF--
+unicode(1) "1"
+unicode(1) "2"
+unicode(1) "3"
+unicode(1) "4"
+unicode(1) "5"
+unicode(1) "6"
+unicode(1) "7"
+unicode(1) "8"
+unicode(1) "9"
+unicode(2) "10"
+unicode(2) "11"
+unicode(2) "12"
+unicode(2) "13"
+unicode(2) "14"
+unicode(2) "15"
+unicode(2) "16"
+unicode(2) "17"
+unicode(2) "18"
+unicode(2) "19"
+unicode(2) "20"
+unicode(2) "21"
+unicode(2) "22"
+unicode(2) "23"
+unicode(2) "24"
+unicode(2) "25"
+unicode(2) "26"
+unicode(2) "27"
+unicode(2) "28"
+unicode(2) "29"
+unicode(2) "30"
+unicode(2) "31"
+unicode(2) "32"
+unicode(2) "33"
+unicode(2) "34"
+unicode(2) "35"
+unicode(2) "36"
+unicode(2) "37"
+unicode(2) "38"
+unicode(2) "39"
+unicode(2) "40"
+unicode(2) "41"
+unicode(2) "42"
+unicode(2) "43"
+unicode(2) "44"
+unicode(2) "45"
+unicode(2) "46"
+unicode(2) "47"
+unicode(2) "48"
+unicode(2) "49"
+unicode(2) "50"
+unicode(2) "51"
+unicode(2) "52"
+unicode(2) "53"
+unicode(2) "54"
+unicode(2) "55"
+unicode(2) "56"
+unicode(2) "57"
+unicode(2) "58"
+unicode(2) "59"
+unicode(2) "60"
+unicode(2) "61"
+unicode(2) "62"
+unicode(2) "63"
+unicode(2) "64"
+unicode(2) "65"
+unicode(2) "66"
+unicode(2) "67"
+unicode(2) "68"
+unicode(2) "69"
+unicode(2) "70"
+unicode(2) "71"
+unicode(2) "72"
+unicode(2) "73"
+unicode(2) "74"
+unicode(2) "75"
+unicode(2) "76"
+unicode(2) "77"
+unicode(2) "78"
+unicode(2) "79"
+unicode(2) "80"
+unicode(2) "81"
+unicode(2) "82"
+unicode(2) "83"
+unicode(2) "84"
+unicode(2) "85"
+unicode(2) "86"
+unicode(2) "87"
+unicode(2) "88"
+unicode(2) "89"
+unicode(2) "90"
+unicode(2) "91"
+unicode(2) "92"
+unicode(2) "93"
+unicode(2) "94"
+unicode(2) "95"
+unicode(2) "96"
+unicode(2) "97"
+unicode(2) "98"
+unicode(2) "99"
+unicode(3) "100"
+unicode(3) "101"
+unicode(3) "102"
+unicode(3) "103"
+unicode(3) "104"
+unicode(3) "105"
+unicode(3) "106"
+unicode(3) "107"
+unicode(3) "108"
+unicode(3) "109"
+unicode(3) "110"
+unicode(3) "111"
+unicode(3) "112"
+unicode(3) "113"
+unicode(3) "114"
+unicode(3) "115"
+unicode(3) "116"
+unicode(3) "117"
+unicode(3) "118"
+unicode(3) "119"
+unicode(3) "120"
+unicode(3) "121"
+unicode(3) "122"
+unicode(3) "123"
+unicode(3) "124"
+unicode(3) "125"
+unicode(3) "126"
+unicode(3) "127"
+unicode(3) "128"
+unicode(3) "129"
+unicode(3) "130"
+unicode(3) "131"
+unicode(3) "132"
+unicode(3) "133"
+unicode(3) "134"
+unicode(3) "135"
+unicode(3) "136"
+unicode(3) "137"
+unicode(3) "138"
+unicode(3) "139"
+unicode(3) "140"
+unicode(3) "141"
+unicode(3) "142"
+unicode(3) "143"
+unicode(3) "144"
+unicode(3) "145"
+unicode(3) "146"
+unicode(3) "147"
+unicode(3) "148"
+unicode(3) "149"
+unicode(3) "150"
+unicode(3) "151"
+unicode(3) "152"
+unicode(3) "153"
+unicode(3) "154"
+unicode(3) "155"
+unicode(3) "156"
+unicode(3) "157"
+unicode(3) "158"
+unicode(3) "159"
+unicode(3) "160"
+unicode(3) "161"
+unicode(3) "162"
+unicode(3) "163"
+unicode(3) "164"
+unicode(3) "165"
+unicode(3) "166"
+unicode(3) "167"
+unicode(3) "168"
+unicode(3) "169"
+unicode(3) "170"
+unicode(3) "171"
+unicode(3) "172"
+unicode(3) "173"
+unicode(3) "174"
+unicode(3) "175"
+unicode(3) "176"
+unicode(3) "177"
+unicode(3) "178"
+unicode(3) "179"
+unicode(3) "180"
+unicode(3) "181"
+unicode(3) "182"
+unicode(3) "183"
+unicode(3) "184"
+unicode(3) "185"
+unicode(3) "186"
+unicode(3) "187"
+unicode(3) "188"
+unicode(3) "189"
+unicode(3) "190"
+unicode(3) "191"
+unicode(3) "192"
+unicode(3) "193"
+unicode(3) "194"
+unicode(3) "195"
+unicode(3) "196"
+unicode(3) "197"
+unicode(3) "198"
+unicode(3) "199"
+Done
index b62f5cfd0fa5ec45ed275d015980309597742af8..af91e6fd318f0fb133b76074f4c15023a4426c48 100644 (file)
@@ -41,3 +41,14 @@ array(1) {
 string(%d) "%s5"
 string(%d) "%sa"
 Done
+--UEXPECTF--
+array(1) {
+  [u"NC"]=>
+  object(OCI-Lob)#%d (1) {
+    [u"descriptor"]=>
+    resource(%d) of type (oci8 descriptor)
+  }
+}
+unicode(%d) "%s5"
+unicode(%d) "%sa"
+Done
index 44b3a6ddca3b45ef0f6d737c0ea5f2ec8ddd43ad..487640ec4bbcc0d6932347da1c13f105b0d9f6a0 100644 (file)
@@ -26,3 +26,9 @@ bool(false)
 string(5) "'ABC'"
 string(4) "CHAR"
 Done
+--UEXPECT--
+bool(false)
+bool(false)
+unicode(5) "'ABC'"
+unicode(4) "CHAR"
+Done
index 7d805d3f70fad27ac93e099a0105c487929abfae..37019e13e4e545bff762f14e3c930a6aa713ca08 100644 (file)
@@ -41,3 +41,9 @@ bool(true)
 bool(true)
 string(6) "string"
 Done
+--UEXPECT--
+bool(true)
+bool(true)
+bool(true)
+unicode(6) "string"
+Done
index dca640e846d017b17d47f14ae3ed34cd20f4ee97..e53f4adb23b49c2cb9e6f843e0fe83c01f8964b4 100644 (file)
@@ -41,3 +41,9 @@ bool(true)
 bool(true)
 string(6) "string"
 Done
+--UEXPECT--
+bool(true)
+bool(true)
+bool(true)
+unicode(6) "string"
+Done
index 543dafd902bc76561f9a5e371a87b6da458c878a..8d59078429047f107d681f4ba2d6181894266342 100644 (file)
@@ -39,3 +39,8 @@ bool(true)
 bool(true)
 string(9) "28-JUL-05"
 Done
+--UEXPECT--
+bool(true)
+bool(true)
+unicode(9) "28-JUL-05"
+Done
index fd1019e411e3bdb6da0cd16a8ac5f0fca6ac39f3..5359453606319833b282342f960f5a794a2472de 100644 (file)
@@ -39,3 +39,8 @@ bool(true)
 bool(true)
 string(9) "28-JUL-05"
 Done
+--UEXPECT--
+bool(true)
+bool(true)
+unicode(9) "28-JUL-05"
+Done
index 00d88bb9a4bb661d5ccdcfd009c89c645dd38c74..d19837bfee0f040dbeb6e8a2e102d573044851ff 100644 (file)
@@ -36,3 +36,8 @@ bool(true)
 bool(true)
 string(9) "01-JAN-05"
 Done
+--UEXPECT--
+bool(true)
+bool(true)
+unicode(9) "01-JAN-05"
+Done
index 0d01bc1744cc9f6faa37781dc98302c0c6f66a12..83052a3d5c49890113840ecdc5dfc0bce9cb93a0 100644 (file)
@@ -36,3 +36,8 @@ bool(true)
 bool(true)
 string(9) "01-JAN-05"
 Done
+--UEXPECT--
+bool(true)
+bool(true)
+unicode(9) "01-JAN-05"
+Done
index 8458525ae5852702bd6fd970542c8b5794a27003..cadab3a38427aa4fe1595ffd6ac15ad46558235e 100644 (file)
@@ -36,3 +36,8 @@ bool(true)
 bool(true)
 string(4) "blah"
 Done
+--UEXPECT--
+bool(true)
+bool(true)
+unicode(4) "blah"
+Done
index a0fe555b618450282674d4abee429878e3723163..aaa7d284206e7cef508c5d999db69ff73a3afa0a 100644 (file)
@@ -36,3 +36,8 @@ bool(true)
 bool(true)
 string(4) "blah"
 Done
+--UEXPECT--
+bool(true)
+bool(true)
+unicode(4) "blah"
+Done
index 9e409f34c6d30c3ed927d62c98ea2cb025b3bd45..1594118e4fa00ed7d8cda7b0bc4b304ea52d3062 100644 (file)
@@ -172,24 +172,24 @@ array(5) {
   [u"ID"]=>
   array(4) {
     [0]=>
-    string(1) "1"
+    unicode(1) "1"
     [1]=>
-    string(1) "1"
+    unicode(1) "1"
     [2]=>
-    string(1) "1"
+    unicode(1) "1"
     [3]=>
-    string(1) "1"
+    unicode(1) "1"
   }
   [u"VALUE"]=>
   array(4) {
     [0]=>
-    string(1) "1"
+    unicode(1) "1"
     [1]=>
-    string(1) "1"
+    unicode(1) "1"
     [2]=>
-    string(1) "1"
+    unicode(1) "1"
     [3]=>
-    string(1) "1"
+    unicode(1) "1"
   }
   [u"BLOB"]=>
   array(4) {
index a8a1c40e1397f2027eef89f105fe37348632f163..4cfc65a0757ea720bf83b011731c90ee0c462057 100644 (file)
@@ -170,24 +170,24 @@ array(5) {
   [u"ID"]=>
   array(4) {
     [0]=>
-    string(1) "1"
+    unicode(1) "1"
     [1]=>
-    string(1) "1"
+    unicode(1) "1"
     [2]=>
-    string(1) "1"
+    unicode(1) "1"
     [3]=>
-    string(1) "1"
+    unicode(1) "1"
   }
   [u"VALUE"]=>
   array(4) {
     [0]=>
-    string(1) "1"
+    unicode(1) "1"
     [1]=>
-    string(1) "1"
+    unicode(1) "1"
     [2]=>
-    string(1) "1"
+    unicode(1) "1"
     [3]=>
-    string(1) "1"
+    unicode(1) "1"
   }
   [u"BLOB"]=>
   array(4) {
index c2ce15cb38ad27989dc66f7a3d13e934e2f045ae..3210034d2f3d9bee3d97ec8d174e8e7b1802b239 100644 (file)
@@ -97,3 +97,24 @@ array(2) {
 }
 bool(false)
 Done
+--UEXPECT--
+array(2) {
+  [0]=>
+  unicode(1) "1"
+  [1]=>
+  unicode(1) "1"
+}
+array(2) {
+  [0]=>
+  unicode(1) "1"
+  [1]=>
+  unicode(1) "1"
+}
+array(2) {
+  [0]=>
+  unicode(1) "1"
+  [1]=>
+  unicode(1) "1"
+}
+bool(false)
+Done
index 865c15ecc0c41b9d237a547842c17a8af0462c44..f8c7059e18b8404d4bad3fc08a1534d86724cb54 100644 (file)
@@ -66,9 +66,9 @@ Done
 --UEXPECTF--
 array(5) {
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"BLOB"]=>
   NULL
   [u"CLOB"]=>
index 13b39f1fb4068fced1f0d797718f9734d52f6289..8be6f63059cb2d78763d5f81db148af21ecc07ce 100644 (file)
@@ -65,18 +65,18 @@ Done
 --UEXPECTF--
 array(2) {
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 bool(true)
 
 Warning: ocifetchinto(): ORA-01002: fetch out of sequence in %s on line %d
 array(2) {
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 bool(true)
 Done
index c76f360f28e480d0fd425cf86f9be19fad6998c7..db775758f2a041cd69efd68464aa66db9b3bc4b9 100644 (file)
@@ -39,3 +39,6 @@ echo "Done\n";
 --EXPECT--
 string(4) "some"
 Done
+--UEXPECT--
+unicode(4) "some"
+Done
index f6e04cc1857421eecd3dae027ce55c6e7ac6700a..089c8c291403135563a31d53470c1dbcb632f8fd 100644 (file)
@@ -50,3 +50,14 @@ Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on li
 NULL
 string(4) "some"
 Done
+--UEXPECTF--
+bool(true)
+bool(false)
+
+Warning: oci_define_by_name(): Column name cannot be empty in %s on line %d
+bool(false)
+
+Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on line %d
+NULL
+unicode(4) "some"
+Done
index da52e619ce5dbe671123336cc1f480a3892600c0..fc3e2b0da91e5e2f7126a069a5fa3ec8f75f484a 100644 (file)
@@ -39,3 +39,6 @@ echo "Done\n";
 --EXPECT--
 string(4) "some"
 Done
+--UEXPECT--
+unicode(4) "some"
+Done
index c38432c90aed4d3d556b354452290d8c621ccb66..974a5f22e4354b8083014de4e6c97f2e89aa9d44 100644 (file)
@@ -45,13 +45,13 @@ resource(%d) of type (oci8 statement)
 Warning: oci_execute(): ORA-00900: invalid SQL statement in %s on line %d
 bool(false)
 array(4) {
-  [u"code"]=>
+  ["code"]=>
   int(900)
-  [u"message"]=>
-  string(32) "ORA-00900: invalid SQL statement"
-  [u"offset"]=>
+  ["message"]=>
+  unicode(32) "ORA-00900: invalid SQL statement"
+  ["offset"]=>
   int(0)
-  [u"sqltext"]=>
-  string(12) "WRONG SYNTAX"
+  ["sqltext"]=>
+  unicode(12) "WRONG SYNTAX"
 }
 Done
index db7670769eaac4630092359b788cfacf9204b270..25a3f09e92d363f78697e2f1d342556d40a40b66 100644 (file)
@@ -25,17 +25,3 @@ array(4) {
   string(0) ""
 }
 Done
---UEXPECTF--
-Warning: oci_connect(): ORA-12154: TNS:could not resolve service name in %s on line %d
-bool(false)
-array(4) {
-  [u"code"]=>
-  int(12154)
-  [u"message"]=>
-  string(45) "ORA-12154: TNS:could not resolve service name"
-  [u"offset"]=>
-  int(0)
-  [u"sqltext"]=>
-  string(0) ""
-}
-Done
index 2b2c279214a46f2e992dbf201ca6a63e3f29bb73..7c27a8b13533320a10495c1f1ecea2264cb5eb89 100644 (file)
@@ -45,13 +45,13 @@ resource(%d) of type (oci8 statement)
 Warning: ociexecute(): ORA-00900: invalid SQL statement in %s on line %d
 bool(false)
 array(4) {
-  [u"code"]=>
+  ["code"]=>
   int(900)
-  [u"message"]=>
-  string(32) "ORA-00900: invalid SQL statement"
-  [u"offset"]=>
+  ["message"]=>
+  unicode(32) "ORA-00900: invalid SQL statement"
+  ["offset"]=>
   int(0)
-  [u"sqltext"]=>
-  string(12) "WRONG SYNTAX"
+  ["sqltext"]=>
+  unicode(12) "WRONG SYNTAX"
 }
 Done
index 33cba657b6b4b26e1c7f9fef64de4458aab1fb0f..4856e5cc516dac0c6dc0d23204746f59c4d367f9 100644 (file)
@@ -54,3 +54,11 @@ string(1) "1"
 string(1) "1"
 string(1) "1"
 Done
+--UEXPECT--
+unicode(1) "1"
+unicode(1) "1"
+unicode(1) "1"
+unicode(1) "1"
+unicode(1) "1"
+unicode(1) "1"
+Done
index a3722c47888a21a76384c06357a8dfa79fa9f5a4..234eacc5d5f4fc07ffabad6d5564ba76125ae5bc 100644 (file)
@@ -153,20 +153,20 @@ array(5) {
   [u"ID"]=>
   array(3) {
     [0]=>
-    string(1) "1"
+    unicode(1) "1"
     [1]=>
-    string(1) "1"
+    unicode(1) "1"
     [2]=>
-    string(1) "1"
+    unicode(1) "1"
   }
   [u"VALUE"]=>
   array(3) {
     [0]=>
-    string(1) "1"
+    unicode(1) "1"
     [1]=>
-    string(1) "1"
+    unicode(1) "1"
     [2]=>
-    string(1) "1"
+    unicode(1) "1"
   }
   [u"BLOB"]=>
   array(3) {
@@ -201,20 +201,20 @@ array(5) {
   [u"ID"]=>
   array(3) {
     [0]=>
-    string(1) "1"
+    unicode(1) "1"
     [1]=>
-    string(1) "1"
+    unicode(1) "1"
     [2]=>
-    string(1) "1"
+    unicode(1) "1"
   }
   [u"VALUE"]=>
   array(3) {
     [0]=>
-    string(1) "1"
+    unicode(1) "1"
     [1]=>
-    string(1) "1"
+    unicode(1) "1"
     [2]=>
-    string(1) "1"
+    unicode(1) "1"
   }
   [u"BLOB"]=>
   array(3) {
index 62d5fcbe8fc595218f95a2684bf818626274b095..07b3e461bb853e319eb62884fc85a507d65d4765 100644 (file)
@@ -309,13 +309,13 @@ Done
 --UEXPECT--
 array(10) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [2]=>
   NULL
   [u"BLOB"]=>
@@ -331,13 +331,13 @@ array(10) {
 }
 array(10) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [2]=>
   NULL
   [u"BLOB"]=>
@@ -353,13 +353,13 @@ array(10) {
 }
 array(10) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [2]=>
   NULL
   [u"BLOB"]=>
@@ -375,109 +375,109 @@ array(10) {
 }
 array(2) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 array(2) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 array(2) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 array(2) {
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 array(2) {
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 array(2) {
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 array(4) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 array(4) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 array(4) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 array(4) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 array(4) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 array(4) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 array(10) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [2]=>
   NULL
   [u"BLOB"]=>
@@ -493,13 +493,13 @@ array(10) {
 }
 array(10) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [2]=>
   NULL
   [u"BLOB"]=>
@@ -515,13 +515,13 @@ array(10) {
 }
 array(10) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [2]=>
   NULL
   [u"BLOB"]=>
index 0c9e574751cc0d59ac48b3793767f8374ca953bc..62d9a332ec56106aa52b97cea977d9dec9649831 100644 (file)
@@ -83,9 +83,9 @@ Done
 --UEXPECT--
 array(5) {
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"BLOB"]=>
   NULL
   [u"CLOB"]=>
@@ -95,9 +95,9 @@ array(5) {
 }
 array(5) {
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"BLOB"]=>
   NULL
   [u"CLOB"]=>
@@ -107,9 +107,9 @@ array(5) {
 }
 array(5) {
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"BLOB"]=>
   NULL
   [u"CLOB"]=>
index 8bd93beaf0d194c27728359b5cc726f5f3befc80..74505423d43da20e61baf8bd1595e34f71090a4a 100644 (file)
@@ -84,20 +84,20 @@ Done
 int(5)
 array(2) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 int(5)
 array(10) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [2]=>
   NULL
   [u"BLOB"]=>
index f7a1b6939dc560eeb7d005ac30027d61a1db22e2..3f8d65c80fe71a71ea461f23633abbe1daec1097 100644 (file)
@@ -194,23 +194,23 @@ Done
 int(5)
 array(2) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 int(5)
 array(2) {
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 int(5)
 array(5) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [2]=>
   NULL
   [3]=>
@@ -221,31 +221,31 @@ array(5) {
 int(5)
 array(2) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 int(5)
 array(4) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
 }
 int(5)
 array(10) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [2]=>
   NULL
   [u"BLOB"]=>
@@ -262,13 +262,13 @@ array(10) {
 int(5)
 array(10) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [2]=>
   NULL
   [u"BLOB"]=>
@@ -285,9 +285,9 @@ array(10) {
 int(5)
 array(5) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [2]=>
   NULL
   [3]=>
@@ -298,9 +298,9 @@ array(5) {
 int(5)
 array(5) {
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"BLOB"]=>
   NULL
   [u"CLOB"]=>
@@ -311,9 +311,9 @@ array(5) {
 int(5)
 array(5) {
   [0]=>
-  string(1) "1"
+  unicode(1) "1"
   [1]=>
-  string(1) "1"
+  unicode(1) "1"
   [2]=>
   NULL
   [3]=>
index c196d39f62bef56f0cd37cf9a050acddfa54bda0..66ed2f88e8738f2611cde7829ef7aa925d441dcd 100644 (file)
@@ -68,3 +68,25 @@ array(2) {
   string(1) "1"
 }
 Done
+--UEXPECTF--
+Warning: ocifetchinto() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Notice: Undefined variable: all in %s on line %d
+NULL
+
+Warning: ocifetchinto() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+NULL
+
+Warning: ocifetchinto(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+NULL
+int(5)
+array(2) {
+  [0]=>
+  unicode(1) "1"
+  [1]=>
+  unicode(1) "1"
+}
+Done
index ce78aa47d50e30bd4a2779c2b1f0febb2013d37b..c4cceb085963e3fa1eb291801cecac139fcf4d13 100644 (file)
@@ -83,9 +83,9 @@ Done
 --UEXPECTF--
 object(stdClass)#%d (5) {
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"BLOB"]=>
   NULL
   [u"CLOB"]=>
@@ -95,9 +95,9 @@ object(stdClass)#%d (5) {
 }
 object(stdClass)#%d (5) {
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"BLOB"]=>
   NULL
   [u"CLOB"]=>
@@ -107,9 +107,9 @@ object(stdClass)#%d (5) {
 }
 object(stdClass)#%d (5) {
   [u"ID"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"VALUE"]=>
-  string(1) "1"
+  unicode(1) "1"
   [u"BLOB"]=>
   NULL
   [u"CLOB"]=>
index a637ecc6f447c01760cb517bf10bcd9082b559d8..35a669a59ae42f8908b7eb5b0f95a186f99fb26e 100644 (file)
@@ -80,3 +80,41 @@ array(5) {
   NULL
 }
 Done
+--UEXPECT--
+array(5) {
+  [0]=>
+  unicode(1) "1"
+  [1]=>
+  unicode(1) "1"
+  [2]=>
+  NULL
+  [3]=>
+  NULL
+  [4]=>
+  NULL
+}
+array(5) {
+  [0]=>
+  unicode(1) "1"
+  [1]=>
+  unicode(1) "1"
+  [2]=>
+  NULL
+  [3]=>
+  NULL
+  [4]=>
+  NULL
+}
+array(5) {
+  [0]=>
+  unicode(1) "1"
+  [1]=>
+  unicode(1) "1"
+  [2]=>
+  NULL
+  [3]=>
+  NULL
+  [4]=>
+  NULL
+}
+Done
index 102f2fdc03829e412a40452ab1cf9825c8c8ca06..1f5e923af42715bff6c8a00f6b5fdb98925effc8 100644 (file)
@@ -103,3 +103,52 @@ int(0)
 int(0)
 int(10)
 Done
+--UEXPECTF--
+array(5) {
+  [0]=>
+  unicode(1) "1"
+  [1]=>
+  unicode(1) "1"
+  [2]=>
+  NULL
+  [3]=>
+  NULL
+  [4]=>
+  NULL
+}
+bool(false)
+unicode(2) "ID"
+unicode(6) "NUMBER"
+int(2)
+int(0)
+int(0)
+int(22)
+bool(false)
+unicode(5) "VALUE"
+unicode(6) "NUMBER"
+int(2)
+int(0)
+int(0)
+int(22)
+bool(true)
+unicode(4) "BLOB"
+unicode(4) "BLOB"
+int(113)
+int(0)
+int(0)
+int(4000)
+bool(true)
+unicode(4) "CLOB"
+unicode(4) "CLOB"
+int(112)
+int(0)
+int(0)
+int(4000)
+bool(true)
+unicode(6) "STRING"
+unicode(8) "VARCHAR2"
+int(1)
+int(0)
+int(0)
+int(10)
+Done
index b41e743e41047c8a6297edefe9eb0144487dab74..c802c0958027fbe95ae9d68bc50400252c6e3af5 100644 (file)
@@ -177,3 +177,104 @@ bool(false)
 Warning: oci_field_size() expects exactly 2 parameters, 1 given in %s on line %d
 bool(false)
 Done
+--UEXPECTF--
+array(5) {
+  [0]=>
+  unicode(1) "1"
+  [1]=>
+  unicode(1) "1"
+  [2]=>
+  NULL
+  [3]=>
+  NULL
+  [4]=>
+  NULL
+}
+
+Warning: oci_field_is_null(): Invalid column index "-1" in %s on line %d
+bool(false)
+
+Warning: oci_field_name(): Invalid column index "-1" in %s on line %d
+bool(false)
+
+Warning: oci_field_type(): Invalid column index "-1" in %s on line %d
+bool(false)
+
+Warning: oci_field_type_raw(): Invalid column index "-1" in %s on line %d
+bool(false)
+
+Warning: oci_field_scale(): Invalid column index "-1" in %s on line %d
+bool(false)
+
+Warning: oci_field_precision(): Invalid column index "-1" in %s on line %d
+bool(false)
+
+Warning: oci_field_size(): Invalid column index "-1" in %s on line %d
+bool(false)
+
+Warning: oci_field_is_null(): Invalid column name "none" in %s on line %d
+bool(false)
+
+Warning: oci_field_name(): Invalid column name "none" in %s on line %d
+bool(false)
+
+Warning: oci_field_type(): Invalid column name "none" in %s on line %d
+bool(false)
+
+Warning: oci_field_type_raw(): Invalid column name "none" in %s on line %d
+bool(false)
+
+Warning: oci_field_scale(): Invalid column name "none" in %s on line %d
+bool(false)
+
+Warning: oci_field_precision(): Invalid column name "none" in %s on line %d
+bool(false)
+
+Warning: oci_field_size(): Invalid column name "none" in %s on line %d
+bool(false)
+
+Warning: oci_field_is_null(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+
+Warning: oci_field_name(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+
+Warning: oci_field_type(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+
+Warning: oci_field_type_raw(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+
+Warning: oci_field_scale(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+
+Warning: oci_field_precision(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+
+Warning: oci_field_size(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+
+Warning: oci_field_is_null(): Invalid column index "0" in %s on line %d
+bool(false)
+
+Warning: oci_field_name(): Invalid column index "0" in %s on line %d
+bool(false)
+
+Warning: oci_field_type(): Invalid column index "0" in %s on line %d
+bool(false)
+
+Warning: oci_field_type_raw(): Invalid column index "0" in %s on line %d
+bool(false)
+
+Warning: oci_field_scale(): Invalid column index "0" in %s on line %d
+bool(false)
+
+Warning: oci_field_precision(): Invalid column index "0" in %s on line %d
+bool(false)
+
+Warning: oci_field_size(): Invalid column index "0" in %s on line %d
+bool(false)
+
+Warning: oci_field_size() expects exactly 2 parameters, 1 given in %s on line %d
+bool(false)
+Done
index e6f21d613d091832da99111496103938b5912521..7af640cc514842599e717c01335272a73da37b85 100644 (file)
@@ -103,3 +103,52 @@ int(0)
 int(0)
 int(10)
 Done
+--UEXPECTF--
+array(5) {
+  [0]=>
+  unicode(1) "1"
+  [1]=>
+  unicode(1) "1"
+  [2]=>
+  NULL
+  [3]=>
+  NULL
+  [4]=>
+  NULL
+}
+bool(false)
+unicode(2) "ID"
+unicode(6) "NUMBER"
+int(2)
+int(0)
+int(0)
+int(22)
+bool(false)
+unicode(5) "VALUE"
+unicode(6) "NUMBER"
+int(2)
+int(0)
+int(0)
+int(22)
+bool(true)
+unicode(4) "BLOB"
+unicode(4) "BLOB"
+int(113)
+int(0)
+int(0)
+int(4000)
+bool(true)
+unicode(4) "CLOB"
+unicode(4) "CLOB"
+int(112)
+int(0)
+int(0)
+int(4000)
+bool(true)
+unicode(6) "STRING"
+unicode(8) "VARCHAR2"
+int(1)
+int(0)
+int(0)
+int(10)
+Done
index 569a85cbcd85fbe30dd8053fb54823f1153dc233..f9defc220d38a6afe25f6e556a7b9bb3011e1817 100644 (file)
Binary files a/ext/oci8/tests/lob_001.phpt and b/ext/oci8/tests/lob_001.phpt differ
index ab53b2805c0bc580aa734c7dd5191d554c51bb12..08fd84a6236d576a84e704cf97daeff07b0e4a39 100644 (file)
@@ -22,12 +22,12 @@ oci_execute($statement, OCI_DEFAULT);
 
 var_dump($blob);
 
-var_dump($blob->write("test", -1));
-var_dump($blob->write("test", "str"));
-var_dump($blob->write("test", 1000000));
-var_dump($blob->write(str_repeat("test", 10000), 1000000));
+var_dump($blob->write(b"test", -1));
+var_dump($blob->write(b"test", "str"));
+var_dump($blob->write(b"test", 1000000));
+var_dump($blob->write((binary)str_repeat("test", 10000), 1000000));
 var_dump($blob->tell());
-var_dump($blob->seek("str", -5));
+var_dump($blob->seek(b"str", -5));
 var_dump($blob->flush());
 
 oci_commit($c);
@@ -77,7 +77,7 @@ int(4)
 int(40000)
 int(40004)
 
-Warning: OCI-Lob::seek() expects parameter 1 to be long, Unicode string given in %s on line %d
+Warning: OCI-Lob::seek() expects parameter 1 to be long, binary string given in %s on line %d
 NULL
 bool(false)
 int(40004)
index 5704548dc310cecd5f471e251ffe38480535d36f..9c3595418ddb27ca6c96352de205fdf18ae48ac3 100644 (file)
Binary files a/ext/oci8/tests/lob_003.phpt and b/ext/oci8/tests/lob_003.phpt differ
index ca6b9e5e4e132b1e66cd6f3047a6ce58e1c76825..c44afe2bb83afab3cd1c793f9ebc0ff0fb66faf1 100644 (file)
@@ -22,9 +22,9 @@ oci_execute($statement, OCI_DEFAULT);
 
 var_dump($blob);
 
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
 var_dump($blob->rewind());
-var_dump($blob->write("str"));
+var_dump($blob->write(b"str"));
 var_dump($blob->seek(10, OCI_SEEK_SET));
 
 oci_commit($c);
index 58e6fb40a9a93e252b6042ea73589f85084356b8..4819aed2f6bd7d3c4779994c5869a15272e6c591 100644 (file)
Binary files a/ext/oci8/tests/lob_006.phpt and b/ext/oci8/tests/lob_006.phpt differ
index 4928e1f7c8757c223506dd9bf24395f22e16c895..e837826e716fdb4bf00d30f69ab7977d2bb4cb26 100644 (file)
@@ -23,7 +23,7 @@ oci_execute($statement, OCI_DEFAULT);
 var_dump($blob);
 
 var_dump($blob->size());
-var_dump($blob->write(str_repeat("string.", 1000)));
+var_dump($blob->write((binary)str_repeat("string.", 1000)));
 var_dump($blob->size());
 oci_commit($c);
 
index bc8e87b4b3029db8adcf002081b126ee76d2a80b..0755b4452ff74f07d4a864a4d6bbc28da37cbee9 100644 (file)
@@ -22,7 +22,7 @@ oci_execute($statement, OCI_DEFAULT);
 
 var_dump($blob);
 
-var_dump($blob->write(str_repeat("string.", 1000)));
+var_dump($blob->write((binary)str_repeat("string.", 1000)));
 oci_commit($c);
 
 $select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
index 59f3e145f207cacb9e112c9fe641fe5b95b05224..ffa34e565872b38fc4f93e85efea4306f3a838bc 100644 (file)
@@ -20,8 +20,8 @@ $blob = oci_new_descriptor($c,OCI_D_LOB);
 oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
 oci_execute($statement, OCI_DEFAULT);
 
-var_dump($blob->save("string"));
-var_dump($blob->save("string", 3));
+var_dump($blob->save(b"string"));
+var_dump($blob->save(b"string", 3));
 oci_commit($c);
 
 $select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
index 0b7f520d9d19ed50e6174671eef620fd063d9d27..cdd08de732c9640978edbf9ebc2f1d88481c8a70 100644 (file)
@@ -20,7 +20,7 @@ $blob = oci_new_descriptor($c,OCI_D_LOB);
 oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
 oci_execute($statement, OCI_DEFAULT);
 
-var_dump($blob->write("some string here. string, I said"));
+var_dump($blob->write(b"some string here. string, I said"));
 oci_commit($c);
 
 $ora_sql = "INSERT INTO
index 2061969bc4c78b43acc5d9491eacefd914782e2a..5c29466e64e9e9019bffb112e7c1b01545749b21 100644 (file)
@@ -22,7 +22,7 @@ oci_execute($statement, OCI_DEFAULT);
 
 $blob;
 
-var_dump($blob->write("test string is here\nnew string"));
+var_dump($blob->write(b"test string is here\nnew string"));
 
 oci_commit($c);
 
index c56de56198b78be299f1bc878dce8c6df80d6df3..7f780c461ebc3c29aab4f0c707281a3be09a335e 100644 (file)
@@ -20,10 +20,10 @@ $blob = oci_new_descriptor($c,OCI_D_LOB);
 oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
 oci_execute($statement, OCI_DEFAULT);
 
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
 var_dump($blob->getBuffering());
 var_dump($blob->setBuffering(true));
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
 var_dump($blob->getBuffering());
 var_dump($blob->flush());
 
index 60ed94531291bd97dad8a29ae65b96b30c748e8b..b32ab0b8950facc69a2333c39ed8c53bf8a1277e 100644 (file)
@@ -22,11 +22,11 @@ oci_execute($statement, OCI_DEFAULT);
 
 $blob;
 
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
 var_dump($blob->close());
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
 var_dump($blob->free());
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
 
 oci_commit($c);
 
index fdb7374ccf5c05caa0e06e70b8298519c2d1d2ec..ffaf04f992e5ea4f43de0b6f0c163b307c0b7b50 100644 (file)
@@ -25,8 +25,8 @@ oci_execute($statement, OCI_DEFAULT);
 
 $row = oci_fetch_assoc($statement);
 
-$row['LOB_1']->write("first");
-$row['LOB_2']->write("second");
+$row['LOB_1']->write(b"first");
+$row['LOB_2']->write(b"second");
 
 unset($row);
 
index 8ab0dc459e203f6a176f9ed96cb58b11f19503c8..4db7830b1586a8dc9942219c4f4faedd2162e2a3 100644 (file)
@@ -27,8 +27,8 @@ oci_execute($statement, OCI_DEFAULT);
 
 $row = oci_fetch_assoc($statement);
 
-$row['LOB_1']->write("first");
-$row['LOB_2']->write("second");
+$row['LOB_1']->write(b"first");
+$row['LOB_2']->write(b"second");
 
 unset($row);
 
index 35cec4bd7df7e9b86739701486a6b3fe1cca1139..d549a51e80af303f363a07a7818331f779ac805d 100644 (file)
@@ -65,3 +65,9 @@ string(9) "long data"
 string(9) "long data"
 string(4) "data"
 Done
+--UEXPECTF--
+unicode(4) "data"
+unicode(9) "long data"
+unicode(9) "long data"
+unicode(4) "data"
+Done
index d972cd792aea62ec1f1d57a17f6edb54eb8f5e96..2f9285bca94fc5e5f91393ea1f92622a4c549f4f 100644 (file)
Binary files a/ext/oci8/tests/lob_019.phpt and b/ext/oci8/tests/lob_019.phpt differ
index 9110e759d6342572ecf8936132e6aecf2b8ff969..c590f2ee6994496652e22fdc5cf9baacede28d04 100644 (file)
Binary files a/ext/oci8/tests/lob_020.phpt and b/ext/oci8/tests/lob_020.phpt differ
index 32ef6f9fef89227d9d7adfca3c6466fc5941e2d4..008afd73bb7456a868b35122aaad13d88fedf1d0 100644 (file)
@@ -20,13 +20,11 @@ $blob = oci_new_descriptor($c,OCI_D_LOB);
 oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
 oci_execute($statement, OCI_DEFAULT);
 
-$blob;
-
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
 var_dump($blob->close());
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
 var_dump(oci_free_descriptor($blob));
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
 
 var_dump(oci_free_descriptor($blob));
 var_dump(oci_free_descriptor(new stdclass));
index 5fb9dfab0ec0bc9c74e4e8e18365e76112a1b771..da0d23b4a1b0870c52e5a271e3acdba9a81ad42f 100644 (file)
@@ -78,3 +78,16 @@ string(9) "long data"
 string(9) "long data"
 string(4) "data"
 Done
+--UEXPECTF--
+Warning: OCI-Lob::save() expects at least 1 parameter, 0 given in %s on line %d
+
+Warning: oci_lob_save() expects at least 2 parameters, 0 given in %s on line %d
+
+Warning: oci_lob_save(): Unable to find descriptor property in %s on line %d
+
+Warning: OCI-Lob::save(): Offset parameter must be greater than or equal to 0 in %s on line %d
+unicode(4) "data"
+unicode(9) "long data"
+unicode(9) "long data"
+unicode(4) "data"
+Done
index 0c352956de0b3139db5dd6da1f34d962eaf5bf63..6d33d69880cbc2e62af2e7959a726faad5ff84c8 100644 (file)
@@ -82,3 +82,40 @@ file for
 test lob_009.phpt
 "
 Done
+--UEXPECTF--
+object(OCI-Lob)#%d (1) {
+  [u"descriptor"]=>
+  resource(%d) of type (oci8 descriptor)
+}
+bool(true)
+bool(true)
+
+Warning: OCI-Lob::import() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_import() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+bool(true)
+
+Warning: oci_lob_import(): Unable to find descriptor property in %s on line %d
+bool(false)
+array(2) {
+  [0]=>
+  object(OCI-Lob)#%d (1) {
+    [u"descriptor"]=>
+    resource(%d) of type (oci8 descriptor)
+  }
+  [u"BLOB"]=>
+  object(OCI-Lob)#%d (1) {
+    [u"descriptor"]=>
+    resource(%d) of type (oci8 descriptor)
+  }
+}
+string(43) "this
+is
+a 
+test
+file for
+test lob_009.phpt
+"
+Done
index 9a7f53240d8766f7f0332469894cc7a984817c66..535196e4c6f28f8625bdfb544e7b372a106858ba 100644 (file)
@@ -23,7 +23,7 @@ oci_execute($statement, OCI_DEFAULT);
 var_dump($blob);
 
 var_dump($blob->size());
-var_dump($blob->write(str_repeat("string.", 1000)));
+var_dump($blob->write((binary)str_repeat("string.", 1000)));
 var_dump($blob->size());
 oci_commit($c);
 
@@ -73,3 +73,32 @@ NULL
 Warning: oci_lob_load(): Unable to find descriptor property in %s on line %d
 bool(false)
 Done
+--UEXPECTF--
+object(OCI-Lob)#%d (1) {
+  [u"descriptor"]=>
+  resource(%d) of type (oci8 descriptor)
+}
+int(0)
+int(7000)
+int(7000)
+array(2) {
+  [0]=>
+  object(OCI-Lob)#%d (1) {
+    [u"descriptor"]=>
+    resource(%d) of type (oci8 descriptor)
+  }
+  [u"BLOB"]=>
+  object(OCI-Lob)#%d (1) {
+    [u"descriptor"]=>
+    resource(%d) of type (oci8 descriptor)
+  }
+}
+int(7000)
+int(7000)
+
+Warning: oci_lob_load() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_load(): Unable to find descriptor property in %s on line %d
+bool(false)
+Done
index 5b5e845a7ac8218b3481d540486fca9829e9c312..64ecbca4adfed54bcad15be0dbc71553ff416624 100644 (file)
@@ -21,7 +21,7 @@ oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
 oci_execute($statement, OCI_DEFAULT);
 
 var_dump($blob->size());
-var_dump($blob->write(str_repeat("string.", 1000)));
+var_dump($blob->write((binary)str_repeat("string.", 1000)));
 var_dump($blob->size());
 oci_commit($c);
 
@@ -80,3 +80,37 @@ bool(false)
 Warning: oci_lob_eof(): Unable to find descriptor property in %s on line %d
 bool(false)
 Done
+--UEXPECTF--
+int(0)
+int(7000)
+int(7000)
+array(2) {
+  [0]=>
+  object(OCI-Lob)#%d (1) {
+    [u"descriptor"]=>
+    resource(%d) of type (oci8 descriptor)
+  }
+  [u"BLOB"]=>
+  object(OCI-Lob)#%d (1) {
+    [u"descriptor"]=>
+    resource(%d) of type (oci8 descriptor)
+  }
+}
+string(2) "st"
+
+Warning: oci_lob_read() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: oci_lob_read() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+bool(false)
+
+Warning: oci_lob_eof() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_read(): Unable to find descriptor property in %s on line %d
+bool(false)
+
+Warning: oci_lob_eof(): Unable to find descriptor property in %s on line %d
+bool(false)
+Done
index 157d78a2b6e57ea37fc2691df745413a07cf1ec6..bd52d7739c91e4c9200aaa962ff82931a8179cee 100644 (file)
@@ -22,10 +22,10 @@ oci_execute($statement, OCI_DEFAULT);
 
 var_dump($blob);
 
-var_dump(oci_lob_write($blob, "test"));
+var_dump(oci_lob_write($blob, b"test"));
 var_dump(oci_lob_rewind());
 var_dump(oci_lob_rewind($blob));
-var_dump(oci_lob_write($blob, "str"));
+var_dump(oci_lob_write($blob, b"str"));
 var_dump(oci_lob_seek(10, OCI_SEEK_SET));
 var_dump(oci_lob_seek($blob, 10, OCI_SEEK_SET));
 
@@ -98,3 +98,43 @@ NULL
 string(4) "strt"
 string(8) "strtstrt"
 Done
+--UEXPECTF--
+object(OCI-Lob)#%d (1) {
+  [u"descriptor"]=>
+  resource(%d) of type (oci8 descriptor)
+}
+int(4)
+
+Warning: oci_lob_rewind() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+bool(true)
+int(3)
+
+Warning: oci_lob_seek() expects parameter 1 to be OCI-Lob, integer given in %s on line %d
+NULL
+bool(true)
+array(2) {
+  [0]=>
+  object(OCI-Lob)#%d (1) {
+    [u"descriptor"]=>
+    resource(%d) of type (oci8 descriptor)
+  }
+  [u"BLOB"]=>
+  object(OCI-Lob)#%d (1) {
+    [u"descriptor"]=>
+    resource(%d) of type (oci8 descriptor)
+  }
+}
+
+Warning: oci_lob_append() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_append() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+bool(true)
+
+Warning: oci_lob_read() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+string(4) "strt"
+string(8) "strtstrt"
+Done
index cad2d39058c5a352d19b5ac796845451a36766a7..ea8e9fe25b8a7b38d2e2efd8fc95471db8db6c3b 100644 (file)
@@ -34,3 +34,13 @@ string(4) "test"
 bool(true)
 string(2) "te"
 Done
+--UEXPECTF--
+bool(true)
+unicode(4) "test"
+bool(true)
+unicode(2) "te"
+bool(true)
+unicode(4) "test"
+bool(true)
+unicode(2) "te"
+Done
index 2482d65f64f61c1aad086e54606f03e8322e5ac7..bc843e41c7b6a0f365ef65971a97a185f000278e 100644 (file)
@@ -30,3 +30,11 @@ bool(true)
 string(4) "test"
 bool(true)
 Done
+--UEXPECTF--
+bool(true)
+unicode(4) "test"
+bool(true)
+bool(true)
+unicode(4) "test"
+bool(true)
+Done
index c369711fcf07d316889d9746244e3748da6165df..670d84ac5ab93af8790a4c673c42450ae12561fa 100644 (file)
@@ -96,3 +96,35 @@ array(2) {
   string(19) "1234567890111111111"
 }
 Done
+--UEXPECT--
+array(2) {
+  [u"L1"]=>
+  unicode(19) "1234567890111111111"
+  [u"L2"]=>
+  unicode(9) "987654321"
+}
+array(2) {
+  [u"L1"]=>
+  unicode(15) "122222222222222"
+  [u"L2"]=>
+  unicode(9) "123456789"
+}
+array(2) {
+  [u"L1"]=>
+  unicode(30) "985456745674567654567654567654"
+  [u"L2"]=>
+  unicode(30) "985456745674567654567654567654"
+}
+array(2) {
+  [u"L1"]=>
+  unicode(9) "123456789"
+  [u"L2"]=>
+  unicode(15) "122222222222222"
+}
+array(2) {
+  [u"L1"]=>
+  unicode(9) "987654321"
+  [u"L2"]=>
+  unicode(19) "1234567890111111111"
+}
+Done
index bf32fe4b54b42d67b9ddfe0dc5a54a1168dc3304..2cfcd37e324e5a8bce2c1e7b5b97a17c57e3e11a 100644 (file)
@@ -28,3 +28,8 @@ resource(%d) of type (oci8 connection)
 string(%d) "%s"
 string(%d) "%s"
 Done
+--UEXPECTF--
+resource(%d) of type (oci8 connection)
+unicode(%d) "%s"
+unicode(%d) "%s"
+Done
index 5e577f05d0cd4271d6a139e6d794407c31ca0de2..60398fe526f519bfb5034e4c6d5a581bc8b863bf 100644 (file)
@@ -36,14 +36,14 @@ Done
 --UEXPECTF--
 array(2) {
   [0]=>
-  string(1) "4"
+  unicode(1) "4"
   [u"1+3"]=>
-  string(1) "4"
+  unicode(1) "4"
 }
 array(2) {
   [0]=>
-  string(1) "4"
+  unicode(1) "4"
   [u"1+3"]=>
-  string(1) "4"
+  unicode(1) "4"
 }
 Done