tony2001 Mon Jul 31 10:30:23 2006 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/oci8/tests bug37581.phpt
Modified files:
/php-src/ext/oci8/tests array_bind_005.phpt
/php-src/ext/oci8 oci8.c oci8_statement.c php_oci8_int.h
/php-src NEWS
Log:
MFH: fix #37581 (oci_bind_array_by_name clobbers input array when using
SQLT_AFC, AVC)
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/array_bind_005.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u
Index: php-src/ext/oci8/tests/array_bind_005.phpt
diff -u php-src/ext/oci8/tests/array_bind_005.phpt:1.1.2.1
php-src/ext/oci8/tests/array_bind_005.phpt:1.1.2.1.2.1
--- php-src/ext/oci8/tests/array_bind_005.phpt:1.1.2.1 Thu Dec 8 22:30:23 2005
+++ php-src/ext/oci8/tests/array_bind_005.phpt Mon Jul 31 10:30:22 2006
@@ -58,7 +58,8 @@
echo "Done\n";
?>
---EXPECT--
+--EXPECTF--
+Warning: oci_execute(): ORA-01405: fetched column value is NULL in %s on line
%d
array(5) {
[0]=>
string(0) ""
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8.c?r1=1.269.2.16.2.9&r2=1.269.2.16.2.10&diff_format=u
Index: php-src/ext/oci8/oci8.c
diff -u php-src/ext/oci8/oci8.c:1.269.2.16.2.9
php-src/ext/oci8/oci8.c:1.269.2.16.2.10
--- php-src/ext/oci8/oci8.c:1.269.2.16.2.9 Wed Jul 26 06:59:40 2006
+++ php-src/ext/oci8/oci8.c Mon Jul 31 10:30:22 2006
@@ -26,7 +26,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8.c,v 1.269.2.16.2.9 2006/07/26 06:59:40 tony2001 Exp $ */
+/* $Id: oci8.c,v 1.269.2.16.2.10 2006/07/31 10:30:22 tony2001 Exp $ */
/* TODO
*
* file://localhost/www/docs/oci10/ociaahan.htm#423823 - implement lob_empty()
with OCI_ATTR_LOBEMPTY
@@ -652,7 +652,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "OCI8 Support", "enabled");
php_info_print_table_row(2, "Version", "1.2.1");
- php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.9 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.10 $");
sprintf(buf, "%ld", OCI_G(num_persistent));
php_info_print_table_row(2, "Active Persistent Connections", buf);
@@ -760,9 +760,10 @@
if (bind->array.elements) {
efree(bind->array.elements);
}
-/* if (bind->array.element_lengths) {
+ if (bind->array.element_lengths) {
efree(bind->array.element_lengths);
}
+/*
if (bind->array.indicators) {
efree(bind->array.indicators);
}
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_statement.c?r1=1.7.2.14.2.1&r2=1.7.2.14.2.2&diff_format=u
Index: php-src/ext/oci8/oci8_statement.c
diff -u php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.1
php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.2
--- php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.1 Sun Jul 30 20:51:24 2006
+++ php-src/ext/oci8/oci8_statement.c Mon Jul 31 10:30:22 2006
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_statement.c,v 1.7.2.14.2.1 2006/07/30 20:51:24 tony2001 Exp $ */
+/* $Id: oci8_statement.c,v 1.7.2.14.2.2 2006/07/31 10:30:22 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
@@ -664,6 +664,8 @@
zval **entry;
HashTable *hash = HASH_OF(bind->zval);
+ zend_hash_internal_pointer_reset(hash);
+
switch (bind->array.type) {
case SQLT_NUM:
case SQLT_INT:
@@ -731,7 +733,8 @@
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 =
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);
@@ -1174,7 +1177,7 @@
(sb4)
bind->array.max_length,
type,
(dvoid *)0, /*
bindp->array.indicators, */
- (ub2 *)0, /*
bindp->array.element_lengths, */
+ (ub2
*)bind->array.element_lengths,
(ub2 *)0, /*
bindp->array.retcodes, */
(ub4)
max_table_length,
(ub4 *)
&(bindp->array.current_length),
@@ -1220,6 +1223,19 @@
bind->array.current_length =
zend_hash_num_elements(Z_ARRVAL_P(var));
bind->array.old_length = bind->array.current_length;
bind->array.max_length = maxlength;
+ bind->array.element_lengths = ecalloc(1, max_table_length *
sizeof(ub2));
+
+ zend_hash_internal_pointer_reset(hash);
+
+ 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);
+ zend_hash_move_forward(hash);
+ } else {
+ break;
+ }
+ }
zend_hash_internal_pointer_reset(hash);
for (i = 0; i < max_table_length; i++) {
@@ -1259,9 +1275,13 @@
bind->array.current_length =
zend_hash_num_elements(Z_ARRVAL_P(var));
bind->array.old_length = bind->array.current_length;
bind->array.max_length = sizeof(ub4);
+ bind->array.element_lengths = ecalloc(1, max_table_length *
sizeof(ub2));
zend_hash_internal_pointer_reset(hash);
for (i = 0; i < max_table_length; i++) {
+ if (i < bind->array.current_length) {
+ bind->array.element_lengths[i] = sizeof(ub4);
+ }
if ((i < bind->array.current_length) &&
(zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
convert_to_long_ex(entry);
((ub4 *)bind->array.elements)[i] = (ub4)
Z_LVAL_PP(entry);
@@ -1292,9 +1312,13 @@
bind->array.current_length =
zend_hash_num_elements(Z_ARRVAL_P(var));
bind->array.old_length = bind->array.current_length;
bind->array.max_length = sizeof(double);
+ bind->array.element_lengths = ecalloc(1, max_table_length *
sizeof(ub2));
zend_hash_internal_pointer_reset(hash);
for (i = 0; i < max_table_length; i++) {
+ if (i < bind->array.current_length) {
+ bind->array.element_lengths[i] = sizeof(double);
+ }
if ((i < bind->array.current_length) &&
(zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
convert_to_double_ex(entry);
((double *)bind->array.elements)[i] = (double)
Z_DVAL_PP(entry);
@@ -1325,10 +1349,14 @@
bind->array.current_length =
zend_hash_num_elements(Z_ARRVAL_P(var));
bind->array.old_length = bind->array.current_length;
bind->array.max_length = sizeof(OCIDate);
+ bind->array.element_lengths = ecalloc(1, max_table_length *
sizeof(ub2));
zend_hash_internal_pointer_reset(hash);
for (i = 0; i < max_table_length; i++) {
OCIDate oci_date;
+ if (i < bind->array.current_length) {
+ bind->array.element_lengths[i] = sizeof(OCIDate);
+ }
if ((i < bind->array.current_length) &&
(zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
convert_to_string_ex(entry);
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/php_oci8_int.h?r1=1.11.2.6.2.2&r2=1.11.2.6.2.3&diff_format=u
Index: php-src/ext/oci8/php_oci8_int.h
diff -u php-src/ext/oci8/php_oci8_int.h:1.11.2.6.2.2
php-src/ext/oci8/php_oci8_int.h:1.11.2.6.2.3
--- php-src/ext/oci8/php_oci8_int.h:1.11.2.6.2.2 Sun Jul 30 20:51:24 2006
+++ php-src/ext/oci8/php_oci8_int.h Mon Jul 31 10:30:22 2006
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_oci8_int.h,v 1.11.2.6.2.2 2006/07/30 20:51:24 tony2001 Exp $ */
+/* $Id: php_oci8_int.h,v 1.11.2.6.2.3 2006/07/31 10:30:22 tony2001 Exp $ */
#if HAVE_OCI8
# ifndef PHP_OCI8_INT_H
@@ -178,9 +178,9 @@
php_oci_statement *parent_statement; /* pointer to the parent
statement */
struct {
void *elements;
-/* ub2 *indicators;
+/* ub2 *indicators; */
ub2 *element_lengths;
- ub2 *retcodes; */
+/* ub2 *retcodes; */
long current_length;
long old_length;
long max_length;
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.167&r2=1.2027.2.547.2.168&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.167 php-src/NEWS:1.2027.2.547.2.168
--- php-src/NEWS:1.2027.2.547.2.167 Mon Jul 31 00:41:45 2006
+++ php-src/NEWS Mon Jul 31 10:30:23 2006
@@ -49,6 +49,8 @@
- Fixed bug #38047 ("file" and "line" sometimes not set in backtrace from
inside error handler). (Dmitry)
- Fixed bug #37846 (wordwrap() wraps incorrectly). (ddk at krasn dot ru, Tony)
+- Fixed bug #37581 (oci_bind_array_by_name clobbers input array when using
+ SQLT_AFC, AVC). (Tony)
- Fixed bug #37564 (AES privacy encryption not possible due to net-snmp 5.2
compatibility issue). (Jani, patch by scott dot moynes+php at gmail dot com)
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/bug37581.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/bug37581.phpt
+++ php-src/ext/oci8/tests/bug37581.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php