diff --git a/pdo_sqlsrv/core_stmt.cpp b/pdo_sqlsrv/core_stmt.cpp index 335186f74..7f3321695 100644 --- a/pdo_sqlsrv/core_stmt.cpp +++ b/pdo_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 ) { - 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; } diff --git a/sqlsrv/core_stmt.cpp b/sqlsrv/core_stmt.cpp index 335186f74..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 ) { - 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; }