iliaa                                    Tue, 12 Jan 2010 12:46:54 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=293447

Log:
Fixed bug #50728 (All PDOExceptions hardcode 'code' property to 0)

Bug: http://bugs.php.net/50728 (Open) All PDOExceptions hardcode 'code' 
property to 0
      
Changed paths:
    U   php/php-src/branches/PHP_5_2/NEWS
    U   php/php-src/branches/PHP_5_2/ext/pdo_dblib/dblib_driver.c
    U   php/php-src/branches/PHP_5_2/ext/pdo_mysql/mysql_driver.c
    U   php/php-src/branches/PHP_5_2/ext/pdo_oci/oci_driver.c
    U   php/php-src/branches/PHP_5_2/ext/pdo_odbc/odbc_driver.c
    U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_driver.c
    U   php/php-src/branches/PHP_5_2/ext/pdo_sqlite/sqlite_driver.c
    A   php/php-src/branches/PHP_5_2/ext/pdo_sqlite/tests/bug50728.phpt
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/pdo_dblib/dblib_driver.c
    U   php/php-src/branches/PHP_5_3/ext/pdo_firebird/firebird_driver.c
    U   php/php-src/branches/PHP_5_3/ext/pdo_mysql/mysql_driver.c
    U   php/php-src/branches/PHP_5_3/ext/pdo_oci/oci_driver.c
    U   php/php-src/branches/PHP_5_3/ext/pdo_odbc/odbc_driver.c
    U   php/php-src/branches/PHP_5_3/ext/pdo_pgsql/pgsql_driver.c
    U   php/php-src/branches/PHP_5_3/ext/pdo_sqlite/sqlite_driver.c
    A   php/php-src/branches/PHP_5_3/ext/pdo_sqlite/tests/bug50728.phpt
    U   php/php-src/trunk/ext/pdo_dblib/dblib_driver.c
    U   php/php-src/trunk/ext/pdo_firebird/firebird_driver.c
    U   php/php-src/trunk/ext/pdo_mysql/mysql_driver.c
    U   php/php-src/trunk/ext/pdo_oci/oci_driver.c
    U   php/php-src/trunk/ext/pdo_odbc/odbc_driver.c
    U   php/php-src/trunk/ext/pdo_pgsql/pgsql_driver.c
    U   php/php-src/trunk/ext/pdo_sqlite/sqlite_driver.c
    A   php/php-src/trunk/ext/pdo_sqlite/tests/bug50728.phpt

Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_2/NEWS	2010-01-12 12:46:54 UTC (rev 293447)
@@ -13,6 +13,8 @@

 - Fixed build of mysqli with MySQL 5.5.0-m2. (Andrey)

+- Fixed bug #50728 (All PDOExceptions hardcode 'code' property to 0). (Joey,
+  Ilia)
 - Fixed bug #50680 (strtotime() does not support eighth ordinal number).
   (Ilia)
 - Fixed bug #50661 (DOMDocument::loadXML does not allow UTF-16). (Rob)

Modified: php/php-src/branches/PHP_5_2/ext/pdo_dblib/dblib_driver.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/pdo_dblib/dblib_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_2/ext/pdo_dblib/dblib_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -255,7 +255,7 @@
 	dbh->driver_data = H;

 	if (!ret) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC,
+		zend_throw_exception_ex(php_pdo_get_exception(), DBLIB_G(err).dberr TSRMLS_CC,
 			"SQLSTATE[%s] %s (severity %d)",
 			DBLIB_G(err).sqlstate,
 			DBLIB_G(err).dberrstr,

Modified: php/php-src/branches/PHP_5_2/ext/pdo_mysql/mysql_driver.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/pdo_mysql/mysql_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_2/ext/pdo_mysql/mysql_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -106,7 +106,7 @@
 #endif

 	if (!dbh->methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
 				*pdo_err, einfo->errcode, einfo->errmsg);
 	}
 /* printf("** [%s:%d] %s %s\n", file, line, *pdo_err, einfo->errmsg); */

Modified: php/php-src/branches/PHP_5_2/ext/pdo_oci/oci_driver.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/pdo_oci/oci_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_2/ext/pdo_oci/oci_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -173,7 +173,7 @@

 	/* little mini hack so that we can use this code from the dbh ctor */
 	if (!dbh->methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg);
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg);
 	}

 	return einfo->errcode;

Modified: php/php-src/branches/PHP_5_2/ext/pdo_odbc/odbc_driver.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/pdo_odbc/odbc_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_2/ext/pdo_odbc/odbc_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -104,7 +104,7 @@
 	strcpy(*pdo_err, einfo->last_state);
 /* printf("@@ SQLSTATE[%s] %s\n", *pdo_err, einfo->last_err_msg); */
 	if (!dbh->methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] %s: %d %s",
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->last_error TSRMLS_CC, "SQLSTATE[%s] %s: %d %s",
 				*pdo_err, what, einfo->last_error, einfo->last_err_msg);
 	}


Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_driver.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -87,7 +87,7 @@
 	}

 	if (!dbh->methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
 				*pdo_err, einfo->errcode, einfo->errmsg);
 	}


Modified: php/php-src/branches/PHP_5_2/ext/pdo_sqlite/sqlite_driver.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/pdo_sqlite/sqlite_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_2/ext/pdo_sqlite/sqlite_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -78,7 +78,7 @@
 	}

 	if (!dbh->methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
 				*pdo_err, einfo->errcode, einfo->errmsg);
 	}


Added: php/php-src/branches/PHP_5_2/ext/pdo_sqlite/tests/bug50728.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/pdo_sqlite/tests/bug50728.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/pdo_sqlite/tests/bug50728.phpt	2010-01-12 12:46:54 UTC (rev 293447)
@@ -0,0 +1,16 @@
+--TEST--
+Bug #50728 (All PDOExceptions hardcode 'code' property to 0)
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
+?>
+--FILE--
+<?php
+try {
+	$a = new PDO("sqlite:/this/path/should/not/exist.db");
+} catch (PDOException $e) {
+	var_dump($e->getCode());
+}
+?>
+--EXPECTF--
+int(14)

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_3/NEWS	2010-01-12 12:46:54 UTC (rev 293447)
@@ -11,6 +11,8 @@
   (Ilia)
 - Added stream_resolve_include_path(). (Mikko)

+- Fixed bug #50728 (All PDOExceptions hardcode 'code' property to 0). (Joey,
+  Ilia)
 - Fixed bug #50680 (strtotime() does not support eighth ordinal number).
   (Ilia)
 - Fixed bug #50661 (DOMDocument::loadXML does not allow UTF-16). (Rob)

Modified: php/php-src/branches/PHP_5_3/ext/pdo_dblib/dblib_driver.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo_dblib/dblib_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_3/ext/pdo_dblib/dblib_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -255,7 +255,7 @@
 	dbh->driver_data = H;

 	if (!ret) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC,
+		zend_throw_exception_ex(php_pdo_get_exception(), DBLIB_G(err).dberr TSRMLS_CC,
 			"SQLSTATE[%s] %s (severity %d)",
 			DBLIB_G(err).sqlstate,
 			DBLIB_G(err).dberrstr,

Modified: php/php-src/branches/PHP_5_3/ext/pdo_firebird/firebird_driver.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo_firebird/firebird_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_3/ext/pdo_firebird/firebird_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -691,7 +691,7 @@
 		char errmsg[512];
 		ISC_STATUS *s = H->isc_status;
 		isc_interprete(errmsg, &s);
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
+		zend_throw_exception_ex(php_pdo_get_exception(), H->isc_status[1] TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
 				"HY000", H->isc_status[1], errmsg);
 	}


Modified: php/php-src/branches/PHP_5_3/ext/pdo_mysql/mysql_driver.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo_mysql/mysql_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_3/ext/pdo_mysql/mysql_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -127,7 +127,7 @@

 	if (!dbh->methods) {
 		PDO_DBG_INF("Throwing exception");
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
 				*pdo_err, einfo->errcode, einfo->errmsg);
 	}


Modified: php/php-src/branches/PHP_5_3/ext/pdo_oci/oci_driver.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo_oci/oci_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_3/ext/pdo_oci/oci_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -173,7 +173,7 @@

 	/* little mini hack so that we can use this code from the dbh ctor */
 	if (!dbh->methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg);
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg);
 	}

 	return einfo->errcode;

Modified: php/php-src/branches/PHP_5_3/ext/pdo_odbc/odbc_driver.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo_odbc/odbc_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_3/ext/pdo_odbc/odbc_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -104,7 +104,7 @@
 	strcpy(*pdo_err, einfo->last_state);
 /* printf("@@ SQLSTATE[%s] %s\n", *pdo_err, einfo->last_err_msg); */
 	if (!dbh->methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] %s: %d %s",
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->last_error TSRMLS_CC, "SQLSTATE[%s] %s: %d %s",
 				*pdo_err, what, einfo->last_error, einfo->last_err_msg);
 	}


Modified: php/php-src/branches/PHP_5_3/ext/pdo_pgsql/pgsql_driver.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo_pgsql/pgsql_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_3/ext/pdo_pgsql/pgsql_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -87,7 +87,7 @@
 	}

 	if (!dbh->methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
 				*pdo_err, einfo->errcode, einfo->errmsg);
 	}


Modified: php/php-src/branches/PHP_5_3/ext/pdo_sqlite/sqlite_driver.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo_sqlite/sqlite_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/branches/PHP_5_3/ext/pdo_sqlite/sqlite_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -78,7 +78,7 @@
 	}

 	if (!dbh->methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
 				*pdo_err, einfo->errcode, einfo->errmsg);
 	}


Added: php/php-src/branches/PHP_5_3/ext/pdo_sqlite/tests/bug50728.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo_sqlite/tests/bug50728.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/pdo_sqlite/tests/bug50728.phpt	2010-01-12 12:46:54 UTC (rev 293447)
@@ -0,0 +1,16 @@
+--TEST--
+Bug #50728 (All PDOExceptions hardcode 'code' property to 0)
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
+?>
+--FILE--
+<?php
+try {
+	$a = new PDO("sqlite:/this/path/should/not/exist.db");
+} catch (PDOException $e) {
+	var_dump($e->getCode());
+}
+?>
+--EXPECTF--
+int(14)

Modified: php/php-src/trunk/ext/pdo_dblib/dblib_driver.c
===================================================================
--- php/php-src/trunk/ext/pdo_dblib/dblib_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/trunk/ext/pdo_dblib/dblib_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -255,7 +255,7 @@
 	dbh->driver_data = H;

 	if (!ret) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC,
+		zend_throw_exception_ex(php_pdo_get_exception(), DBLIB_G(err).dberr TSRMLS_CC,
 			"SQLSTATE[%s] %s (severity %d)",
 			DBLIB_G(err).sqlstate,
 			DBLIB_G(err).dberrstr,

Modified: php/php-src/trunk/ext/pdo_firebird/firebird_driver.c
===================================================================
--- php/php-src/trunk/ext/pdo_firebird/firebird_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/trunk/ext/pdo_firebird/firebird_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -686,7 +686,7 @@
 		char errmsg[512];
 		ISC_STATUS *s = H->isc_status;
 		isc_interprete(errmsg, &s);
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
+		zend_throw_exception_ex(php_pdo_get_exception(), H->isc_status[1] TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
 				"HY000", H->isc_status[1], errmsg);
 	}


Modified: php/php-src/trunk/ext/pdo_mysql/mysql_driver.c
===================================================================
--- php/php-src/trunk/ext/pdo_mysql/mysql_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/trunk/ext/pdo_mysql/mysql_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -127,7 +127,7 @@

 	if (!dbh->methods) {
 		PDO_DBG_INF("Throwing exception");
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
 				*pdo_err, einfo->errcode, einfo->errmsg);
 	}


Modified: php/php-src/trunk/ext/pdo_oci/oci_driver.c
===================================================================
--- php/php-src/trunk/ext/pdo_oci/oci_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/trunk/ext/pdo_oci/oci_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -173,7 +173,7 @@

 	/* little mini hack so that we can use this code from the dbh ctor */
 	if (!dbh->methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg);
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg);
 	}

 	return einfo->errcode;

Modified: php/php-src/trunk/ext/pdo_odbc/odbc_driver.c
===================================================================
--- php/php-src/trunk/ext/pdo_odbc/odbc_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/trunk/ext/pdo_odbc/odbc_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -85,15 +85,9 @@
 	einfo->what = what;

 	strcpy(*pdo_err, einfo->last_state);
-/* printf("@@ SQLSTATE[%s] %s\n", *pdo_err, einfo->last_err_msg); */
 	if (!dbh->methods) {
-#if PHP_VERSION_ID > 50200
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] %s: %d %s",
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->last_error TSRMLS_CC, "SQLSTATE[%s] %s: %d %s",
 				*pdo_err, what, einfo->last_error, einfo->last_err_msg);
-#else
-		zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s] %s: %d %s",
-				*pdo_err, what, einfo->last_error, einfo->last_err_msg);
-#endif
 	}
 }
 /* }}} */

Modified: php/php-src/trunk/ext/pdo_pgsql/pgsql_driver.c
===================================================================
--- php/php-src/trunk/ext/pdo_pgsql/pgsql_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/trunk/ext/pdo_pgsql/pgsql_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -87,7 +87,7 @@
 	}

 	if (!dbh->methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
 				*pdo_err, einfo->errcode, einfo->errmsg);
 	}


Modified: php/php-src/trunk/ext/pdo_sqlite/sqlite_driver.c
===================================================================
--- php/php-src/trunk/ext/pdo_sqlite/sqlite_driver.c	2010-01-12 12:33:17 UTC (rev 293446)
+++ php/php-src/trunk/ext/pdo_sqlite/sqlite_driver.c	2010-01-12 12:46:54 UTC (rev 293447)
@@ -102,7 +102,7 @@
 	}

 	if (!dbh->methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
 				*pdo_err, einfo->errcode, einfo->errmsg);
 	}


Added: php/php-src/trunk/ext/pdo_sqlite/tests/bug50728.phpt
===================================================================
--- php/php-src/trunk/ext/pdo_sqlite/tests/bug50728.phpt	                        (rev 0)
+++ php/php-src/trunk/ext/pdo_sqlite/tests/bug50728.phpt	2010-01-12 12:46:54 UTC (rev 293447)
@@ -0,0 +1,16 @@
+--TEST--
+Bug #50728 (All PDOExceptions hardcode 'code' property to 0)
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
+?>
+--FILE--
+<?php
+try {
+	$a = new PDO("sqlite:/this/path/should/not/exist.db");
+} catch (PDOException $e) {
+	var_dump($e->getCode());
+}
+?>
+--EXPECTF--
+int(14)
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to