Skip to content

Commit

Permalink
Rename internal_construct()
Browse files Browse the repository at this point in the history
  • Loading branch information
kocsismate committed Oct 2, 2024
1 parent 63e1e32 commit c80949e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
9 changes: 4 additions & 5 deletions ext/pdo/pdo_dbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ static bool create_driver_specific_pdo_object(pdo_driver_t *driver, zend_class_e

if (ce_based_on_driver_name) {
if (called_scope != pdo_dbh_ce) {
/* A driver-specific implementation is instantiated of a wrong driver class */
/* A driver-specific implementation is instantiated with a wrong driver class */
zend_throw_exception_ex(pdo_exception_ce, 0,
"%s::%s() cannot be called when connecting to the \"%s\" driver, "
"either call %s::%s() or PDO::%s() instead",
Expand All @@ -282,7 +282,6 @@ static bool create_driver_specific_pdo_object(pdo_driver_t *driver, zend_class_e
return false;
}

/* A driver-specific implementation was instantiated via PDO::__construct() */
if (new_object) {
object_init_ex(new_object, ce_based_on_driver_name);
}
Expand All @@ -294,7 +293,7 @@ static bool create_driver_specific_pdo_object(pdo_driver_t *driver, zend_class_e
return true;
}

PDO_API void internal_construct(INTERNAL_FUNCTION_PARAMETERS, zend_object *object, zend_class_entry *current_scope, zval *new_zval_object)
PDO_API void php_pdo_internal_construct_driver(INTERNAL_FUNCTION_PARAMETERS, zend_object *object, zend_class_entry *current_scope, zval *new_zval_object)
{
pdo_dbh_t *dbh = NULL;
bool is_persistent = 0;
Expand Down Expand Up @@ -517,14 +516,14 @@ PDO_API void internal_construct(INTERNAL_FUNCTION_PARAMETERS, zend_object *objec
/* {{{ */
PHP_METHOD(PDO, __construct)
{
internal_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), execute_data->func->common.scope, NULL);
php_pdo_internal_construct_driver(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), execute_data->func->common.scope, NULL);
}
/* }}} */

/* {{{ */
PHP_METHOD(PDO, connect)
{
internal_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), EX(This).value.ce, return_value);
php_pdo_internal_construct_driver(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), EX(This).value.ce, return_value);
}
/* }}} */

Expand Down
2 changes: 1 addition & 1 deletion ext/pdo/php_pdo_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ PDO_API void php_pdo_dbh_delref(pdo_dbh_t *dbh);
PDO_API void php_pdo_free_statement(pdo_stmt_t *stmt);
PDO_API void php_pdo_stmt_set_column_count(pdo_stmt_t *stmt, int new_count);

PDO_API void internal_construct(INTERNAL_FUNCTION_PARAMETERS, zend_object *object, zend_class_entry *current_scope, zval *new_zval_object);
PDO_API void php_pdo_internal_construct_driver(INTERNAL_FUNCTION_PARAMETERS, zend_object *object, zend_class_entry *current_scope, zval *new_zval_object);

/* Normalization for fetching long param for driver attributes */
PDO_API bool pdo_get_long_param(zend_long *lval, zval *value);
Expand Down
2 changes: 1 addition & 1 deletion ext/pdo_dblib/pdo_dblib.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,5 @@ PHP_MINFO_FUNCTION(pdo_dblib)

PHP_METHOD(Pdo_Dblib, __construct)
{
internal_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), execute_data->func->common.scope, NULL);
php_pdo_internal_construct_driver(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), execute_data->func->common.scope, NULL);
}
2 changes: 1 addition & 1 deletion ext/pdo_firebird/pdo_firebird.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ PHP_MINFO_FUNCTION(pdo_firebird) /* {{{ */

PHP_METHOD(Pdo_Firebird, __construct)
{
internal_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), execute_data->func->common.scope, NULL);
php_pdo_internal_construct_driver(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), execute_data->func->common.scope, NULL);
}

PHP_METHOD(Pdo_Firebird, getApiVersion)
Expand Down
2 changes: 1 addition & 1 deletion ext/pdo_mysql/pdo_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static const MYSQLND_REVERSE_API pdo_mysql_reverse_api = {

PHP_METHOD(Pdo_Mysql, __construct)
{
internal_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), execute_data->func->common.scope, NULL);
php_pdo_internal_construct_driver(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), execute_data->func->common.scope, NULL);
}

/* Returns the number of SQL warnings during the execution of the last statement */
Expand Down
2 changes: 1 addition & 1 deletion ext/pdo_odbc/pdo_odbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ zend_ulong pdo_odbc_pool_mode = SQL_CP_ONE_PER_HENV;

PHP_METHOD(Pdo_Odbc, __construct)
{
internal_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), execute_data->func->common.scope, NULL);
php_pdo_internal_construct_driver(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), execute_data->func->common.scope, NULL);
}

/* {{{ PHP_MINIT_FUNCTION */
Expand Down
2 changes: 1 addition & 1 deletion ext/pdo_pgsql/pdo_pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ZEND_GET_MODULE(pdo_pgsql)

PHP_METHOD(Pdo_Pgsql, __construct)
{
internal_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), execute_data->func->common.scope, NULL);
php_pdo_internal_construct_driver(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), execute_data->func->common.scope, NULL);
}

/* Escape an identifier for insertion into a text field */
Expand Down
2 changes: 1 addition & 1 deletion ext/pdo_sqlite/pdo_sqlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ static int php_sqlite_collation_callback(void *context, int string1_len, const v

PHP_METHOD(Pdo_Sqlite, __construct)
{
internal_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), execute_data->func->common.scope, NULL);
php_pdo_internal_construct_driver(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_OBJ(EX(This)), execute_data->func->common.scope, NULL);
}

PHP_METHOD(Pdo_Sqlite, createAggregate)
Expand Down

0 comments on commit c80949e

Please sign in to comment.