php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #74732
Patch boolean_path revision 2017-07-17 08:39 UTC by vnkbabu@php.net

Patch boolean_path for ibm_db2 Bug #74732

Patch version 2017-07-17 08:39 UTC

Return to Bug #74732 | Download this patch
Patch Revisions:

Developer: vnkbabu@php.net

--- ibm_db2.c	2017-07-13 02:39:57.000000000 -0400
+++ /TMP/ibm_db2.c	2017-07-17 03:18:24.993176437 -0400
@@ -2411,7 +2411,7 @@
 	char *database = NULL;
 	char *uid = NULL;
 	char *password = NULL;
-	int argc = ZEND_NUM_ARGS();
+	size_t argc = ZEND_NUM_ARGS();
 	zval *options = NULL, newEntrydata;
 	int rc = 0;
 	SQLINTEGER conn_alive;
@@ -2467,13 +2467,13 @@
 		/* Check if we already have a connection for this userID & database combination */
 		if (isPersistent) {
 			ZEND_RESOURCE *entry;
-			hKeyLen = strlen(database) + strlen(uid) + strlen(password) + 9;
+			hKeyLen = strlen(database) + strlen(uid) +  8;
 			hKey = (char *) ecalloc(1, hKeyLen);
 
-			sprintf(hKey, "__db2_%s.%s.%s", uid, database, password);
+			sprintf(hKey, "__db2_%s.%s", uid, database);
 
 #if PHP_MAJOR_VERSION >= 7
-            temp = zend_hash_str_find_ind(&EG(persistent_list), hKey, hKeyLen );
+            temp = zend_hash_str_find_ind(&EG(persistent_list), hKey, hKeyLen);
 
             if ( temp != NULL ) {
                 entry = Z_RES_P(temp);
@@ -4556,7 +4556,23 @@
 	switch(ZEND_Z_TYPE_PP(bind_data)) {
 #if PHP_MAJOR_VERSION >= 7
         case IS_TRUE:
+			curr->long_value = 1;
+			rc = SQLBindParameter(stmt_res->hstmt, curr->param_num,
+					curr->param_type, SQL_C_LONG, curr->data_type,
+					curr->param_size, curr->scale, &curr->long_value, 0, NULL);
+			if ( rc == SQL_ERROR ) {
+				_php_db2_check_sql_errors(stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1, NULL, -1, 1 TSRMLS_CC);
+			}
+			break;
         case IS_FALSE:
+			curr->long_value = 0; 
+			rc = SQLBindParameter(stmt_res->hstmt, curr->param_num,
+					curr->param_type, SQL_C_LONG, curr->data_type,
+					curr->param_size, curr->scale, &curr->long_value, 0, NULL);
+			if ( rc == SQL_ERROR ) {
+				_php_db2_check_sql_errors(stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1, NULL, -1, 1 TSRMLS_CC);
+			}
+			break;
 #else
         case IS_BOOL:
 #endif
@@ -4735,10 +4751,12 @@
 		while (curr != NULL ) {
 			/* Fetch data from symbol table */
 #if PHP_MAJOR_VERSION >= 7
-            temp =  zend_hash_str_find_ind( &EG(ACTIVE_SYMBOL_TABLE), curr->varname, strlen(curr->varname) );
+            temp =  zend_hash_str_find_ind( &EG(ACTIVE_SYMBOL_TABLE), curr->varname, strlen(curr->varname)+1 );
             if(temp != NULL) {
                 bind_data = &temp;
 #else
+		case IS_LONG:
+			curr->long_value = (SQLINTEGER)(curr->value)->value.lval;
                 if ( zend_hash_find(EG(ACTIVE_SYMBOL_TABLE), curr->varname,
                             strlen(curr->varname)+1, (void **) &bind_data ) != FAILURE ){ 
 #endif
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Jan 20 20:01:24 2021 UTC