diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index 640de63774d9..48a02070ecd1 100644 --- a/ext/pdo_odbc/odbc_driver.c +++ b/ext/pdo_odbc/odbc_driver.c @@ -41,15 +41,13 @@ static void pdo_odbc_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in einfo = &S->einfo; } - if (einfo->last_err_msg != NULL) { - message = strpprintf(0, "%s (%s[%ld] at %s:%d)", - einfo->last_err_msg, - einfo->what, (long) einfo->last_error, - einfo->file, einfo->line); - } else { - message = ZSTR_EMPTY_ALLOC(); + if (einfo->last_err_msg == NULL || strlen(einfo->last_err_msg) == 0) { + return; } - + message = strpprintf(0, "%s (%s[%ld] at %s:%d)", + einfo->last_err_msg, + einfo->what, (long) einfo->last_error, + einfo->file, einfo->line); add_next_index_long(info, einfo->last_error); add_next_index_str(info, message); add_next_index_string(info, einfo->last_state);