summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Jones <sixd@php.net>2011-11-07 20:10:41 +0000
committerChristopher Jones <sixd@php.net>2011-11-07 20:10:41 +0000
commit76d68f8dbd72da8340407d5a3f612986cf0674c4 (patch)
treecf8c189b591b0190845135020d142c4df13c8f7c
parentff48763f4b0fee906293815b42fe3e2a167702c8 (diff)
downloadphp-git-76d68f8dbd72da8340407d5a3f612986cf0674c4.tar.gz
Improve OCI8 NLS env creation error messages (#58925)
-rw-r--r--ext/oci8/oci8.c9
-rw-r--r--ext/oci8/package.xml1
2 files changed, 10 insertions, 0 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 275483ee2f..b943c28454 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -2901,11 +2901,20 @@ static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC)
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIEnvNlsCreate, (&retenv, OCI_G(events) ? PHP_OCI_INIT_MODE | OCI_EVENTS : PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL, charsetid, charsetid));
if (OCI_G(errcode) != OCI_SUCCESS) {
+ sb4 ora_error_code = 0;
+ text ora_msg_buf[OCI_ERROR_MAXMSG_SIZE]; /* Use traditional smaller size: non-PL/SQL errors should fit and it keeps the stack smaller */
+
#ifdef HAVE_OCI_INSTANT_CLIENT
php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that " PHP_OCI8_LIB_PATH_MSG " includes the directory with Oracle Instant Client libraries");
#else
php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and " PHP_OCI8_LIB_PATH_MSG " are set and point to the right directories");
#endif
+ if (retenv
+ && OCIErrorGet(retenv, (ub4)1, NULL, &ora_error_code, ora_msg_buf, (ub4)OCI_ERROR_MAXMSG_SIZE, (ub4)OCI_HTYPE_ENV) == OCI_SUCCESS
+ && *ora_msg_buf) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ora_msg_buf);
+ }
+
return NULL;
}
return retenv;
diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml
index b91b4b2448..526336f85f 100644
--- a/ext/oci8/package.xml
+++ b/ext/oci8/package.xml
@@ -47,6 +47,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<license uri="http://www.php.net/license">PHP</license>
<notes>
Increased maximum possible Oracle DB error message length
+ Improve internal initalization failure error messages
</notes>
<contents>
<dir name="/">