]> granicus.if.org Git - php/commitdiff
Fix #35552
authorWez Furlong <wez@php.net>
Sun, 30 Apr 2006 00:52:28 +0000 (00:52 +0000)
committerWez Furlong <wez@php.net>
Sun, 30 Apr 2006 00:52:28 +0000 (00:52 +0000)
NEWS
ext/pdo_odbc/odbc_driver.c

diff --git a/NEWS b/NEWS
index 60154813c7e94c4784e3e3ab05b91be0ed5ada8b..353e1d5985e751a326498b0414f03c2d1835c0a1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2006, PHP 5.2.0
+- Fixed bug #35552 (crash when pdo_odbc prepare fails). (Wez).
 
 28 Apr 2006, PHP 5.1.3
 - Updated bundled PCRE library to version 6.6. (Andrei)
index 08120720beb6fcba288e2297f7ee60e3ddad1767..8309b23a5abc14e02601275c64f3182c4c41eb4a 100755 (executable)
@@ -198,13 +198,21 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, p
                efree(nsql);
        }
 
+       stmt->driver_data = S;
+       stmt->methods = &odbc_stmt_methods;
+
        if (rc != SQL_SUCCESS) {
                pdo_odbc_stmt_error("SQLPrepare");
+        if (rc != SQL_SUCCESS_WITH_INFO) {
+            /* clone error information into the db handle */
+            strcpy(H->einfo.last_err_msg, S->einfo.last_err_msg);
+            H->einfo.file = S->einfo.file;
+            H->einfo.line = S->einfo.line;
+            H->einfo.what = S->einfo.what;
+            strcpy(dbh->error_code, stmt->error_code);
+        }
        }
 
-       stmt->driver_data = S;
-       stmt->methods = &odbc_stmt_methods;
-
        if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
                return 0;
        }