diff --git a/ext/pdo/tests/bug_38253.phpt b/ext/pdo/tests/bug_38253.phpt index d40c1b6e9746a..91d94d31aeef8 100644 --- a/ext/pdo/tests/bug_38253.phpt +++ b/ext/pdo/tests/bug_38253.phpt @@ -43,18 +43,18 @@ PDOTest::dropTableIfExists($db, "test38253"); --EXPECTF-- Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: No fetch class specified in %s on line %d -Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error%s on line %d +Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error in %s on line %d array(0) { } Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: No fetch function specified in %s on line %d -Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error%s on line %d +Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error in %s on line %d array(0) { } Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: No fetch-into object specified. in %s on line %d -Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error%s on line %d +Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error in %s on line %d array(0) { } diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index 1ddce74f3f92c..d84bf66ef9884 100644 --- a/ext/pdo_odbc/odbc_driver.c +++ b/ext/pdo_odbc/odbc_driver.c @@ -41,6 +41,11 @@ static void pdo_odbc_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in einfo = &S->einfo; } + /* If we don't have a driver error do not populate the info array */ + if (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,