Merge branch 'PHP-8.0'

* PHP-8.0:
  Fixed bug #81037 PDO discards error message text from prepared statement

Closes GH-6978.
This commit is contained in:
Kamil Tekiela 2021-05-14 12:00:34 +01:00
commit dbfc9f99d1
No known key found for this signature in database
GPG key ID: 0760BDAB1E89A1E3
3 changed files with 42 additions and 2 deletions

View file

@ -94,7 +94,11 @@ int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int lin
dbh->is_persistent);
} else {
einfo->errmsg = pestrdup(mysql_error(H->server), dbh->is_persistent);
if (S && S->stmt) {
einfo->errmsg = pestrdup(mysql_stmt_error(S->stmt), dbh->is_persistent);
} else {
einfo->errmsg = pestrdup(mysql_error(H->server), dbh->is_persistent);
}
}
} else { /* no error */
strcpy(*pdo_err, PDO_ERR_NONE);