From: Antony Dovgal Date: Wed, 28 Mar 2007 23:05:36 +0000 (+0000) Subject: Oracle seems to return non zero terminated strings or strings with only 1 zero at... X-Git-Tag: RELEASE_1_1_0~87 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee1a5253510c44b78995ac0f52c470c59f288c12;p=php 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() --- 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;