From: Wez Furlong Date: Fri, 12 Aug 2005 23:32:31 +0000 (+0000) Subject: zts fixes X-Git-Tag: PRE_NEW_OCI8_EXTENSION~289 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f6276a2b8ac455c0b03c5f0625c5a56ad6296bda;p=php zts fixes --- diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c index c80f0602ed..faf2d5e150 100755 --- a/ext/pdo/pdo.c +++ b/ext/pdo/pdo.c @@ -55,7 +55,7 @@ int php_pdo_list_entry(void) /* for exceptional circumstances */ zend_class_entry *pdo_exception_ce; -PDO_API zend_class_entry *php_pdo_get_exception(void) +PDO_API zend_class_entry *php_pdo_get_exception(TSRMLS_D) { return U_CLASS_ENTRY(pdo_exception_ce); } @@ -381,7 +381,7 @@ PHP_MINIT_FUNCTION(pdo) #if can_handle_soft_dependency_on_SPL && defined(HAVE_SPL) && ((PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1)) pdo_exception_ce = zend_register_internal_class_ex(&ce, spl_ce_RuntimeException, NULL TSRMLS_CC); #else - pdo_exception_ce = zend_register_internal_class_ex(&ce, zend_exception_get_default(), NULL TSRMLS_CC); + pdo_exception_ce = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC); #endif zend_declare_property_null(pdo_exception_ce, "errorInfo", sizeof("errorInfo")-1, ZEND_ACC_PUBLIC TSRMLS_CC); diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 2f517c1627..83de7012cd 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -84,7 +84,7 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate } } else { zval *ex; - zend_class_entry *def_ex = zend_exception_get_default(), *pdo_ex = php_pdo_get_exception(); + zend_class_entry *def_ex = zend_exception_get_default(TSRMLS_C), *pdo_ex = php_pdo_get_exception(TSRMLS_C); MAKE_STD_ZVAL(ex); object_init_ex(ex, pdo_ex); @@ -165,7 +165,7 @@ void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) } } else if (EG(exception) == NULL) { zval *ex; - zend_class_entry *def_ex = zend_exception_get_default(), *pdo_ex = php_pdo_get_exception(); + zend_class_entry *def_ex = zend_exception_get_default(TSRMLS_C), *pdo_ex = php_pdo_get_exception(TSRMLS_C); MAKE_STD_ZVAL(ex); object_init_ex(ex, pdo_ex); @@ -235,7 +235,7 @@ static PHP_FUNCTION(dbh_constructor) snprintf(alt_dsn, sizeof(alt_dsn), "pdo.dsn.%s", data_source); if (FAILURE == cfg_get_string(alt_dsn, &ini_dsn)) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "invalid data source name"); + zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "invalid data source name"); ZVAL_NULL(object); return; } @@ -244,7 +244,7 @@ static PHP_FUNCTION(dbh_constructor) colon = strchr(data_source, ':'); if (!colon) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "invalid data source name (via INI: %s)", alt_dsn); + zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "invalid data source name (via INI: %s)", alt_dsn); ZVAL_NULL(object); return; } @@ -254,13 +254,13 @@ static PHP_FUNCTION(dbh_constructor) /* the specified URI holds connection details */ data_source = dsn_from_uri(data_source, alt_dsn, sizeof(alt_dsn) TSRMLS_CC); if (!data_source) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "invalid data source URI"); + zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "invalid data source URI"); ZVAL_NULL(object); return; } colon = strchr(data_source, ':'); if (!colon) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "invalid data source name (via URI)"); + zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "invalid data source name (via URI)"); ZVAL_NULL(object); return; } @@ -271,7 +271,7 @@ static PHP_FUNCTION(dbh_constructor) if (!driver) { /* NB: don't want to include the data_source in the error message as * it might contain a password */ - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "could not find driver"); + zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "could not find driver"); ZVAL_NULL(object); return; } @@ -583,14 +583,14 @@ static PHP_METHOD(PDO, beginTransaction) pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC); if (dbh->in_txn) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "There is already an active transaction"); + zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "There is already an active transaction"); RETURN_FALSE; } if (!dbh->methods->begin) { /* TODO: this should be an exception; see the auto-commit mode * comments below */ - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "This driver doesn't support transactions"); + zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "This driver doesn't support transactions"); RETURN_FALSE; } @@ -611,7 +611,7 @@ static PHP_METHOD(PDO, commit) pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC); if (!dbh->in_txn) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "There is no active transaction"); + zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "There is no active transaction"); RETURN_FALSE; } @@ -632,7 +632,7 @@ static PHP_METHOD(PDO, rollBack) pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC); if (!dbh->in_txn) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "There is no active transaction"); + zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "There is no active transaction"); RETURN_FALSE; } @@ -714,7 +714,7 @@ static PHP_METHOD(PDO, setAttribute) fail: if (attr == PDO_ATTR_AUTOCOMMIT) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "The auto-commit mode cannot be changed for this driver"); + zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "The auto-commit mode cannot be changed for this driver"); } else if (!dbh->methods->set_attribute) { pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support setting attributes" TSRMLS_CC); } else { diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h index 11650ac65e..c054410cdd 100755 --- a/ext/pdo/php_pdo_driver.h +++ b/ext/pdo/php_pdo_driver.h @@ -617,7 +617,7 @@ PDO_API int php_pdo_parse_data_source(const char *data_source, unsigned long data_source_len, struct pdo_data_src_parser *parsed, int nparams); -PDO_API zend_class_entry *php_pdo_get_exception(void); +PDO_API zend_class_entry *php_pdo_get_exception(TSRMLS_D); PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **outquery, int *outquery_len TSRMLS_DC); diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c index 23087775a5..c3065b92bc 100644 --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@ -247,7 +247,7 @@ cleanup: 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(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s] %s (severity %d)", DBLIB_G(err).sqlstate, DBLIB_G(err).dberrstr, diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index d880a259e3..6321eb24f8 100755 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -97,7 +97,7 @@ int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int lin #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(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s", *pdo_err, einfo->errcode, einfo->errmsg); } /* printf("** [%s:%d] %s %s\n", file, line, *pdo_err, einfo->errmsg); */ diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c index 50113c4790..7d52bdc5a6 100755 --- a/ext/pdo_oci/oci_driver.c +++ b/ext/pdo_oci/oci_driver.c @@ -146,7 +146,7 @@ ub4 _oci_error(OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, swor /* 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(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg); } return einfo->errcode; diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index 99e05e1322..4952c1aa62 100755 --- a/ext/pdo_odbc/odbc_driver.c +++ b/ext/pdo_odbc/odbc_driver.c @@ -87,7 +87,7 @@ void pdo_odbc_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, PDO_ODBC_HSTMT statement, 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(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s] %s: %d %s", *pdo_err, what, einfo->last_error, einfo->last_err_msg); } } diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index 43ed6e3258..5c15e4f13d 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -80,7 +80,7 @@ int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char * } 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(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s", *pdo_err, einfo->errcode, einfo->errmsg); } diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index e3734d4a7c..b5304410b9 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -75,7 +75,7 @@ int _pdo_sqlite_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int li } 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(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s", *pdo_err, einfo->errcode, einfo->errmsg); } @@ -692,7 +692,7 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS filename = make_filename_safe(dbh->data_source TSRMLS_CC); if (!filename) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, + zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "safe_mode/open_basedir prohibits opening %s", dbh->data_source); goto cleanup;