]> granicus.if.org Git - php/commitdiff
MFH: fix segfault on rebindinging and rexecuting a statement with LOBs
authorAntony Dovgal <tony2001@php.net>
Wed, 31 Jan 2007 13:55:43 +0000 (13:55 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 31 Jan 2007 13:55:43 +0000 (13:55 +0000)
fix compile failure in ZTS mode when collections support is missing

ext/oci8/oci8.c
ext/oci8/oci8_statement.c
ext/oci8/php_oci8_int.h

index 64a830a78e05a51a4f2e26638d92b847ac8cccfc..ac221129a2e0396aa34898561a4f97dc21aa95ef 100644 (file)
@@ -89,7 +89,9 @@ static void php_oci_connection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC);
 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 @@ PHP_RSHUTDOWN_FUNCTION(oci)
 {
 #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);
        }
@@ -742,6 +746,7 @@ static void php_oci_descriptor_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
        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 @@ static void php_oci_collection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
        php_oci_collection *collection = (php_oci_collection *)entry->ptr;
        php_oci_collection_close(collection TSRMLS_CC);
 } /* }}} */
+#endif
 
 /* }}} */
 
index 1b036e8924fe1dcaf28ac091fe65a1eaca3f9cb1..95e40bf598fa4ebbe44576cdb8ca8df484c6d0dc 100644 (file)
@@ -828,7 +828,9 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
  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 @@ sb4 php_oci_bind_out_callback(
                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);
index cee37dbc73ec457bc7872edf00d0e2bbce4ab4a3..5615d8a3ed0a2c0cdfcb6c53238cb62d67546eb6 100644 (file)
@@ -190,6 +190,7 @@ typedef struct { /* php_oci_bind {{{ */
        } 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 {{{ */