mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
oci8 - Increase Oracle error message length for 11.2.0.3+
This commit is contained in:
parent
f6dfff1081
commit
89a4d34646
4
NEWS
4
NEWS
@ -60,6 +60,10 @@ PHP NEWS
|
||||
. Fixed bug #55067 (MySQL doesn't support compression - wrong config option).
|
||||
(Andrey)
|
||||
|
||||
- Oracle Database extension (OCI8):
|
||||
. Increased maxium Oracle error message buffer length for new 11.2.0.3 size
|
||||
(Chris Jones)
|
||||
|
||||
- PDO
|
||||
. Fixed bug #55776 (PDORow to session bug). (Johannes)
|
||||
|
||||
|
@ -106,7 +106,12 @@ zend_class_entry *oci_coll_class_entry_ptr;
|
||||
#define SQLT_CFILEE 115
|
||||
#endif
|
||||
|
||||
#define PHP_OCI_ERRBUF_LEN 1024
|
||||
#ifdef OCI_ERROR_MAXMSG_SIZE2
|
||||
/* Bigger size is defined from 11.2.0.3 onwards */
|
||||
#define PHP_OCI_ERRBUF_LEN OCI_ERROR_MAXMSG_SIZE2
|
||||
#else
|
||||
#define PHP_OCI_ERRBUF_LEN OCI_ERROR_MAXMSG_SIZE
|
||||
#endif
|
||||
|
||||
#if ZEND_MODULE_API_NO > 20020429
|
||||
#define ONUPDATELONGFUNC OnUpdateLong
|
||||
@ -1063,7 +1068,7 @@ static void php_oci_init_global_handles(TSRMLS_D)
|
||||
{
|
||||
sword errstatus;
|
||||
sb4 ora_error_code = 0;
|
||||
text tmp_buf[PHP_OCI_ERRBUF_LEN];
|
||||
text tmp_buf[OCI_ERROR_MAXMSG_SIZE]; /* Use traditional smaller size: non-PL/SQL errors should fit and it keeps the stack smaller */
|
||||
|
||||
errstatus = OCIEnvNlsCreate(&OCI_G(env), PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL, 0, 0);
|
||||
|
||||
@ -1074,7 +1079,7 @@ static void php_oci_init_global_handles(TSRMLS_D)
|
||||
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 (OCI_G(env)
|
||||
&& OCIErrorGet(OCI_G(env), (ub4)1, NULL, &ora_error_code, tmp_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ENV) == OCI_SUCCESS
|
||||
&& OCIErrorGet(OCI_G(env), (ub4)1, NULL, &ora_error_code, tmp_buf, (ub4)OCI_ERROR_MAXMSG_SIZE, (ub4)OCI_HTYPE_ENV) == OCI_SUCCESS
|
||||
&& *tmp_buf) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", tmp_buf);
|
||||
}
|
||||
@ -1103,7 +1108,7 @@ static void php_oci_init_global_handles(TSRMLS_D)
|
||||
PHP_OCI_CALL(OCIHandleFree, (cpoolh, OCI_HTYPE_CPOOL));
|
||||
#endif
|
||||
} else {
|
||||
OCIErrorGet(OCI_G(env), (ub4)1, NULL, &ora_error_code, tmp_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ERROR);
|
||||
OCIErrorGet(OCI_G(env), (ub4)1, NULL, &ora_error_code, tmp_buf, (ub4)OCI_ERROR_MAXMSG_SIZE, (ub4)OCI_HTYPE_ERROR);
|
||||
|
||||
if (ora_error_code) {
|
||||
int tmp_buf_len = strlen((char *)tmp_buf);
|
||||
@ -2181,10 +2186,10 @@ static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC)
|
||||
return 1;
|
||||
} else {
|
||||
sb4 error_code = 0;
|
||||
text tmp_buf[PHP_OCI_ERRBUF_LEN];
|
||||
text tmp_buf[OCI_ERROR_MAXMSG_SIZE];
|
||||
|
||||
/* Treat ORA-1010 as a successful Ping */
|
||||
OCIErrorGet(OCI_G(err), (ub4)1, NULL, &error_code, tmp_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ERROR);
|
||||
OCIErrorGet(OCI_G(err), (ub4)1, NULL, &error_code, tmp_buf, (ub4)OCI_ERROR_MAXMSG_SIZE, (ub4)OCI_HTYPE_ERROR);
|
||||
if (error_code == 1010) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -33,21 +33,20 @@ http://pear.php.net/dtd/package-2.0.xsd">
|
||||
<active>no</active>
|
||||
</lead>
|
||||
|
||||
<date>2011-08-22</date>
|
||||
<date>2011-10-25</date>
|
||||
<time>12:00:00</time>
|
||||
|
||||
<version>
|
||||
<release>1.4.6</release>
|
||||
<api>1.4.6</api>
|
||||
<release>1.4.7</release>
|
||||
<api>1.4.7</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<release>devel</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>
|
||||
Added oci_client_version() returning the runtime Oracle client library version
|
||||
Made OCI8 extension buildable with PHP 5.4-development code
|
||||
Increased maximum possible Oracle DB error message length
|
||||
</notes>
|
||||
<contents>
|
||||
<dir name="/">
|
||||
@ -251,6 +250,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
|
||||
<file name="edition_2.phpt" role="test" />
|
||||
<file name="error1.phpt" role="test" />
|
||||
<file name="error2.phpt" role="test" />
|
||||
<file name="error3.phpt" role="test" />
|
||||
<file name="error_bind.phpt" role="test" />
|
||||
<file name="error_old.phpt" role="test" />
|
||||
<file name="error_parse.phpt" role="test" />
|
||||
@ -338,7 +338,6 @@ http://pear.php.net/dtd/package-2.0.xsd">
|
||||
<file name="null_byte_2.phpt" role="test" />
|
||||
<file name="null_byte_3.phpt" role="test" />
|
||||
<file name="num.phpt" role="test" />
|
||||
<file name="oci8safemode.phpt" role="test" />
|
||||
<file name="oci_execute_segfault.phpt" role="test" />
|
||||
<file name="old_oci_close1.phpt" role="test" />
|
||||
<file name="old_oci_close.phpt" role="test" />
|
||||
@ -408,6 +407,22 @@ http://pear.php.net/dtd/package-2.0.xsd">
|
||||
</extsrcrelease>
|
||||
<changelog>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.4.6</release>
|
||||
<api>1.4.6</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>
|
||||
Added oci_client_version() returning the runtime Oracle client library version
|
||||
Made OCI8 extension buildable with PHP 5.4-development code
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.4.5</release>
|
||||
|
@ -46,7 +46,7 @@
|
||||
*/
|
||||
#undef PHP_OCI8_VERSION
|
||||
#endif
|
||||
#define PHP_OCI8_VERSION "1.4.6"
|
||||
#define PHP_OCI8_VERSION "1.4.7-devel"
|
||||
|
||||
extern zend_module_entry oci8_module_entry;
|
||||
#define phpext_oci8_ptr &oci8_module_entry
|
||||
|
@ -4,6 +4,13 @@ Bug #47281 ($php_errormsg is limited in size of characters)
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
// error3.phpt obsoletes this test for newer Oracle client versions
|
||||
// Assume runtime client version is >= compile time client version
|
||||
$cv = explode('.', oci_client_version());
|
||||
if ($cv[0] > 11 || ($cv[0] == 11 && $cv[1] > 2) || ($cv[0] == 11 && $cv[1] == 2 && $cv[3] >= 3)) {
|
||||
die("skip test works only with Oracle 11.2.0.2 or earlier Oracle client libraries");
|
||||
}
|
||||
|
||||
?>
|
||||
--ENV--
|
||||
NLS_LANG=.AL32UTF8
|
||||
|
40
ext/oci8/tests/error3.phpt
Normal file
40
ext/oci8/tests/error3.phpt
Normal file
@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Maximum Oracle error length
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
// Assume runtime client version is >= compile time client version
|
||||
$cv = explode('.', oci_client_version());
|
||||
if ($cv[0] < 11 || ($cv[0] == 11 && $cv[1] < 2) || ($cv[0] == 11 && $cv[1] == 2 && $cv[3] < 3)) {
|
||||
die("skip test works only with Oracle 11.2.0.3 or greater version of Oracle client libraries");
|
||||
}
|
||||
?>
|
||||
--INI--
|
||||
log_errors_max_len=4096
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
echo "Test 1\n";
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$s = oci_parse($c, "declare
|
||||
s varchar2(4000);
|
||||
begin
|
||||
s := 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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