From ee1a5253510c44b78995ac0f52c470c59f288c12 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Wed, 28 Mar 2007 23:05:36 +0000 Subject: [PATCH] Oracle seems to return non zero terminated strings or strings with only 1 zero at the end in Unicode mode surely u_strlen() doesn't like it, so lets use OCIStringSize() and avoid u_strlen() --- ext/oci8/oci8_collection.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index 5ab6481748..30018105b5 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -503,14 +503,17 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z { OCIString *oci_string = *(OCIString **)element; text *str; + ub4 str_len; PHP_OCI_CALL_RETURN(str, OCIStringPtr, (connection->env, oci_string)); if (str) { + PHP_OCI_CALL_RETURN(str_len, OCIStringSize, (connection->env, oci_string)); + if (UG(unicode)) { - ZVAL_UNICODE(*result_element, (UChar *)str, 1); + ZVAL_UNICODEL(*result_element, (UChar *)str, TEXT_CHARS(str_len), 1); } else { - ZVAL_STRING(*result_element, str, 1); + ZVAL_STRINGL(*result_element, str, str_len, 1); } } return 0; -- 2.50.1