pajoye                                   Wed, 03 Feb 2010 19:48:04 +0000

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

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

Bug: http://bugs.php.net/50728 (Closed) All PDOExceptions hardcode 'code' 
property to 0
      
Changed paths:
    _U  php/php-src/branches/PHP_5_3_2/
    U   php/php-src/branches/PHP_5_3_2/ext/pdo_dblib/dblib_driver.c
    U   php/php-src/branches/PHP_5_3_2/ext/pdo_firebird/firebird_driver.c
    U   php/php-src/branches/PHP_5_3_2/ext/pdo_mysql/mysql_driver.c
    U   php/php-src/branches/PHP_5_3_2/ext/pdo_oci/oci_driver.c
    U   php/php-src/branches/PHP_5_3_2/ext/pdo_odbc/odbc_driver.c
    U   php/php-src/branches/PHP_5_3_2/ext/pdo_pgsql/pgsql_driver.c
    U   php/php-src/branches/PHP_5_3_2/ext/pdo_sqlite/sqlite_driver.c
    A + php/php-src/branches/PHP_5_3_2/ext/pdo_sqlite/tests/bug50728.phpt
        (from 
php/php-src/branches/PHP_5_3/ext/pdo_sqlite/tests/bug50728.phpt:r293447)
    _U  php/php-src/branches/PHP_5_3_2/ext/tidy/tests/
    _U  
php/php-src/branches/PHP_5_3_2/tests/security/open_basedir_parse_ini_file.phpt


Property changes on: php/php-src/branches/PHP_5_3_2
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/php/php-src/branches/PHP_5_3:292504,292574,292594-292595,292611,292624,292630,292632-292635,292654,292677,292682-292683,292693,292719,292762,292765,292771,292777,292823,293051,293075,293114,293126,293131,293144,293146,293152,293176,293180,293216,293268,293341,293380,293400,293442,293502,293538,293548,293558,293974
/php/php-src/trunk:284726
   + 
/php/php-src/branches/PHP_5_3:292504,292574,292594-292595,292611,292624,292630,292632-292635,292654,292677,292682-292683,292693,292719,292762,292765,292771,292777,292823,293051,293075,293114,293126,293131,293144,293146,293152,293176,293180,293216,293268,293341,293380,293400,293442,293447,293502,293538,293548,293558,293974
/php/php-src/trunk:284726

Modified: php/php-src/branches/PHP_5_3_2/ext/pdo_dblib/dblib_driver.c
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/pdo_dblib/dblib_driver.c 2010-02-03 
19:44:23 UTC (rev 294443)
+++ php/php-src/branches/PHP_5_3_2/ext/pdo_dblib/dblib_driver.c 2010-02-03 
19:48:04 UTC (rev 294444)
@@ -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_2/ext/pdo_firebird/firebird_driver.c
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/pdo_firebird/firebird_driver.c   
2010-02-03 19:44:23 UTC (rev 294443)
+++ php/php-src/branches/PHP_5_3_2/ext/pdo_firebird/firebird_driver.c   
2010-02-03 19:48:04 UTC (rev 294444)
@@ -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_2/ext/pdo_mysql/mysql_driver.c
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/pdo_mysql/mysql_driver.c 2010-02-03 
19:44:23 UTC (rev 294443)
+++ php/php-src/branches/PHP_5_3_2/ext/pdo_mysql/mysql_driver.c 2010-02-03 
19:48:04 UTC (rev 294444)
@@ -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_2/ext/pdo_oci/oci_driver.c
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/pdo_oci/oci_driver.c     2010-02-03 
19:44:23 UTC (rev 294443)
+++ php/php-src/branches/PHP_5_3_2/ext/pdo_oci/oci_driver.c     2010-02-03 
19:48:04 UTC (rev 294444)
@@ -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_2/ext/pdo_odbc/odbc_driver.c
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/pdo_odbc/odbc_driver.c   2010-02-03 
19:44:23 UTC (rev 294443)
+++ php/php-src/branches/PHP_5_3_2/ext/pdo_odbc/odbc_driver.c   2010-02-03 
19:48:04 UTC (rev 294444)
@@ -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_2/ext/pdo_pgsql/pgsql_driver.c
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/pdo_pgsql/pgsql_driver.c 2010-02-03 
19:44:23 UTC (rev 294443)
+++ php/php-src/branches/PHP_5_3_2/ext/pdo_pgsql/pgsql_driver.c 2010-02-03 
19:48:04 UTC (rev 294444)
@@ -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_2/ext/pdo_sqlite/sqlite_driver.c
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/pdo_sqlite/sqlite_driver.c       
2010-02-03 19:44:23 UTC (rev 294443)
+++ php/php-src/branches/PHP_5_3_2/ext/pdo_sqlite/sqlite_driver.c       
2010-02-03 19:48:04 UTC (rev 294444)
@@ -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);
        }


Copied: php/php-src/branches/PHP_5_3_2/ext/pdo_sqlite/tests/bug50728.phpt (from 
rev 293447, php/php-src/branches/PHP_5_3/ext/pdo_sqlite/tests/bug50728.phpt)
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/pdo_sqlite/tests/bug50728.phpt           
                (rev 0)
+++ php/php-src/branches/PHP_5_3_2/ext/pdo_sqlite/tests/bug50728.phpt   
2010-02-03 19:48:04 UTC (rev 294444)
@@ -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)


Property changes on: php/php-src/branches/PHP_5_3_2/ext/tidy/tests
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/php/php-src/branches/PHP_5_3/ext/tidy/tests:292562,292566,292571,292574,292635,292719,292765,293146,293152,293176,293180,293216,293380,293400,293442,293502,293538,293548,293558
/php/php-src/trunk/ext/tidy/tests:284726,287798-287941
   + 
/php/php-src/branches/PHP_5_3/ext/tidy/tests:292562,292566,292571,292574,292635,292719,292765,293146,293152,293176,293180,293216,293380,293400,293442,293447,293502,293538,293548,293558
/php/php-src/trunk/ext/tidy/tests:284726,287798-287941


Property changes on: 
php/php-src/branches/PHP_5_3_2/tests/security/open_basedir_parse_ini_file.phpt
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/php/php-src/branches/PHP_5_3/tests/security/open_basedir_parse_ini_file.phpt:292562,292566,292571,292574,293146,293152,293176,293180,293216,293380,293400,293442,293502,293538,293548,293558
/php/php-src/trunk/tests/security/open_basedir_parse_ini_file.phpt:265951
   + 
/php/php-src/branches/PHP_5_3/tests/security/open_basedir_parse_ini_file.phpt:292562,292566,292571,292574,293146,293152,293176,293180,293216,293380,293400,293442,293447,293502,293538,293548,293558
/php/php-src/trunk/tests/security/open_basedir_parse_ini_file.phpt:265951

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

Reply via email to