tony2001                Wed Jan 31 13:55:43 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/oci8   oci8.c oci8_statement.c php_oci8_int.h 
  Log:
  MFH: fix segfault on rebindinging and rexecuting a statement with LOBs
  fix compile failure in ZTS mode when collections support is missing
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8.c?r1=1.269.2.16.2.29&r2=1.269.2.16.2.30&diff_format=u
Index: php-src/ext/oci8/oci8.c
diff -u php-src/ext/oci8/oci8.c:1.269.2.16.2.29 
php-src/ext/oci8/oci8.c:1.269.2.16.2.30
--- php-src/ext/oci8/oci8.c:1.269.2.16.2.29     Wed Jan 24 14:34:13 2007
+++ php-src/ext/oci8/oci8.c     Wed Jan 31 13:55:43 2007
@@ -26,7 +26,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: oci8.c,v 1.269.2.16.2.29 2007/01/24 14:34:13 tony2001 Exp $ */
+/* $Id: oci8.c,v 1.269.2.16.2.30 2007/01/31 13:55:43 tony2001 Exp $ */
 /* TODO
  *
  * file://localhost/www/docs/oci10/ociaahan.htm#423823 - implement lob_empty() 
with OCI_ATTR_LOBEMPTY
@@ -89,7 +89,9 @@
 static void php_oci_pconnection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC);
 static void php_oci_statement_list_dtor (zend_rsrc_list_entry * TSRMLS_DC);
 static void php_oci_descriptor_list_dtor (zend_rsrc_list_entry * TSRMLS_DC);
+#ifdef PHP_OCI8_HAVE_COLLECTIONS 
 static void php_oci_collection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC);
+#endif
 
 static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC);
 #ifdef ZTS
@@ -646,7 +648,9 @@
 {
 #ifdef ZTS
        zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) 
php_oci_list_helper, (void *)le_descriptor TSRMLS_CC);
+#ifdef PHP_OCI8_HAVE_COLLECTIONS 
        zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) 
php_oci_list_helper, (void *)le_collection TSRMLS_CC);
+#endif
        while (OCI_G(num_statements)) { 
                zend_hash_apply_with_argument(&EG(regular_list), 
(apply_func_arg_t) php_oci_list_helper, (void *)le_statement TSRMLS_CC);
        }
@@ -670,7 +674,7 @@
        php_info_print_table_start();
        php_info_print_table_row(2, "OCI8 Support", "enabled");
        php_info_print_table_row(2, "Version", "1.2.3");
-       php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.29 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.30 $");
 
        sprintf(buf, "%ld", OCI_G(num_persistent));
        php_info_print_table_row(2, "Active Persistent Connections", buf);
@@ -742,6 +746,7 @@
        php_oci_lob_free(descriptor TSRMLS_CC);
 } /* }}} */
 
+#ifdef PHP_OCI8_HAVE_COLLECTIONS 
 /* {{{ php_oci_collection_list_dtor()
  Collection destructor */
 static void php_oci_collection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
@@ -749,6 +754,7 @@
        php_oci_collection *collection = (php_oci_collection *)entry->ptr;
        php_oci_collection_close(collection TSRMLS_CC);
 } /* }}} */
+#endif
 
 /* }}} */
 
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_statement.c?r1=1.7.2.14.2.21&r2=1.7.2.14.2.22&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.21 
php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.22
--- php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.21     Thu Jan 25 09:31:23 2007
+++ php-src/ext/oci8/oci8_statement.c   Wed Jan 31 13:55:43 2007
@@ -25,7 +25,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: oci8_statement.c,v 1.7.2.14.2.21 2007/01/25 09:31:23 tony2001 Exp $ */
+/* $Id: oci8_statement.c,v 1.7.2.14.2.22 2007/01/31 13:55:43 tony2001 Exp $ */
 
 
 #ifdef HAVE_CONFIG_H
@@ -828,7 +828,9 @@
  Bind zval to the given placeholder */
 int php_oci_bind_by_name(php_oci_statement *statement, char *name, int 
name_len, zval* var, long maxlength, long type TSRMLS_DC)
 {
+#ifdef PHP_OCI8_HAVE_COLLECTIONS 
        php_oci_collection *bind_collection = NULL;
+#endif
        php_oci_descriptor *bind_descriptor = NULL;
        php_oci_statement  *bind_statement  = NULL;
        dvoid *oci_desc                 = NULL;
@@ -1095,7 +1097,17 @@
                return retval;
        }
 
-       if ((Z_TYPE_P(val) == IS_OBJECT) || (Z_TYPE_P(val) == IS_RESOURCE)) {
+       if (Z_TYPE_P(val) == IS_RESOURCE) {
+               retval = OCI_CONTINUE;
+       } else if (Z_TYPE_P(val) == IS_OBJECT) {
+               if (!phpbind->descriptor) {
+                       return OCI_ERROR;
+               }
+               *alenpp = &phpbind->dummy_len;
+               *bufpp = phpbind->descriptor;
+               *piecep = OCI_ONE_PIECE;
+               *rcodepp = &phpbind->retcode;
+               *indpp = &phpbind->indicator;
                retval = OCI_CONTINUE;
        } else {
                convert_to_string(val);
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/php_oci8_int.h?r1=1.11.2.6.2.13&r2=1.11.2.6.2.14&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.13 
php-src/ext/oci8/php_oci8_int.h:1.11.2.6.2.14
--- php-src/ext/oci8/php_oci8_int.h:1.11.2.6.2.13       Thu Jan 11 11:27:52 2007
+++ php-src/ext/oci8/php_oci8_int.h     Wed Jan 31 13:55:43 2007
@@ -25,7 +25,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_oci8_int.h,v 1.11.2.6.2.13 2007/01/11 11:27:52 tony2001 Exp $ */
+/* $Id: php_oci8_int.h,v 1.11.2.6.2.14 2007/01/31 13:55:43 tony2001 Exp $ */
 
 #if HAVE_OCI8
 # ifndef PHP_OCI8_INT_H
@@ -190,6 +190,7 @@
        } array;
        sb2 indicator;                  /* -1 means NULL */
        ub2 retcode;                    /*  */
+       ub4 dummy_len;          /* a dummy var to store alenpp value in bind 
OUT callback */
 } php_oci_bind; /* }}} */
 
 typedef struct { /* php_oci_out_column {{{ */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to