From e7fd1594359b84a94488d0a0717d3549667c7cd1 Mon Sep 17 00:00:00 2001 From: Hadis-Fard Date: Fri, 9 Dec 2016 13:05:20 -0800 Subject: [PATCH 1/2] fixed Github #182, empty bound output parameters --- pdo_sqlsrv/core_stmt.cpp | 2 +- sqlsrv/core_stmt.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pdo_sqlsrv/core_stmt.cpp b/pdo_sqlsrv/core_stmt.cpp index 335186f74..b5566f6e0 100644 --- a/pdo_sqlsrv/core_stmt.cpp +++ b/pdo_sqlsrv/core_stmt.cpp @@ -1990,7 +1990,7 @@ void finalize_output_parameters( sqlsrv_stmt* stmt TSRMLS_DC ) // adjust the length of the string to the value returned by SQLBindParameter in the ind_ptr parameter char* str = Z_STRVAL_P( value_z ); SQLLEN str_len = stmt->param_ind_ptrs[ output_param->param_num ]; - if( str_len == SQL_NULL_DATA ) { + if( str_len == SQL_NULL_DATA || str_len == 0 ) { zend_string_release( Z_STR_P( value_z )); ZVAL_NULL( value_z ); continue; diff --git a/sqlsrv/core_stmt.cpp b/sqlsrv/core_stmt.cpp index 335186f74..1094088b5 100644 --- a/sqlsrv/core_stmt.cpp +++ b/sqlsrv/core_stmt.cpp @@ -1990,7 +1990,7 @@ void finalize_output_parameters( sqlsrv_stmt* stmt TSRMLS_DC ) // adjust the length of the string to the value returned by SQLBindParameter in the ind_ptr parameter char* str = Z_STRVAL_P( value_z ); SQLLEN str_len = stmt->param_ind_ptrs[ output_param->param_num ]; - if( str_len == SQL_NULL_DATA ) { + if( str_len == SQL_NULL_DATA || str_len == 0) { zend_string_release( Z_STR_P( value_z )); ZVAL_NULL( value_z ); continue; From 47e13b32c6d3426cb9cb99a1fac4943605ad4ea7 Mon Sep 17 00:00:00 2001 From: Hadis-Fard Date: Thu, 15 Dec 2016 14:06:47 -0800 Subject: [PATCH 2/2] fixed tab and spacing --- pdo_sqlsrv/core_stmt.cpp | 2 +- sqlsrv/core_stmt.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pdo_sqlsrv/core_stmt.cpp b/pdo_sqlsrv/core_stmt.cpp index b5566f6e0..7f3321695 100644 --- a/pdo_sqlsrv/core_stmt.cpp +++ b/pdo_sqlsrv/core_stmt.cpp @@ -1991,7 +1991,7 @@ void finalize_output_parameters( sqlsrv_stmt* stmt TSRMLS_DC ) char* str = Z_STRVAL_P( value_z ); SQLLEN str_len = stmt->param_ind_ptrs[ output_param->param_num ]; if( str_len == SQL_NULL_DATA || str_len == 0 ) { - zend_string_release( Z_STR_P( value_z )); + zend_string_release( Z_STR_P( value_z )); ZVAL_NULL( value_z ); continue; } diff --git a/sqlsrv/core_stmt.cpp b/sqlsrv/core_stmt.cpp index 1094088b5..7f3321695 100644 --- a/sqlsrv/core_stmt.cpp +++ b/sqlsrv/core_stmt.cpp @@ -1990,8 +1990,8 @@ void finalize_output_parameters( sqlsrv_stmt* stmt TSRMLS_DC ) // adjust the length of the string to the value returned by SQLBindParameter in the ind_ptr parameter char* str = Z_STRVAL_P( value_z ); SQLLEN str_len = stmt->param_ind_ptrs[ output_param->param_num ]; - if( str_len == SQL_NULL_DATA || str_len == 0) { - zend_string_release( Z_STR_P( value_z )); + if( str_len == SQL_NULL_DATA || str_len == 0 ) { + zend_string_release( Z_STR_P( value_z )); ZVAL_NULL( value_z ); continue; }