wez             Sun Apr 30 00:52:29 2006 UTC

  Modified files:              (Branch: PHP_5_1)
    /php-src    NEWS 
    /php-src/ext/pdo_odbc       odbc_driver.c 
  Log:
  Fix #35552
  
  
  
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.536&r2=1.2027.2.537&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.536 php-src/NEWS:1.2027.2.537
--- php-src/NEWS:1.2027.2.536   Wed Apr 26 16:07:11 2006
+++ php-src/NEWS        Sun Apr 30 00:52:28 2006
@@ -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)
http://cvs.php.net/viewcvs.cgi/php-src/ext/pdo_odbc/odbc_driver.c?r1=1.27.2.2&r2=1.27.2.3&diff_format=u
Index: php-src/ext/pdo_odbc/odbc_driver.c
diff -u php-src/ext/pdo_odbc/odbc_driver.c:1.27.2.2 
php-src/ext/pdo_odbc/odbc_driver.c:1.27.2.3
--- php-src/ext/pdo_odbc/odbc_driver.c:1.27.2.2 Wed Dec 14 04:56:22 2005
+++ php-src/ext/pdo_odbc/odbc_driver.c  Sun Apr 30 00:52:28 2006
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: odbc_driver.c,v 1.27.2.2 2005/12/14 04:56:22 wez Exp $ */
+/* $Id: odbc_driver.c,v 1.27.2.3 2006/04/30 00:52:28 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -198,13 +198,21 @@
                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;
        }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to