Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions ext/pdo/pdo_dbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, pdo_error_type sqlst
}

if (dbh->error_mode != PDO_ERRMODE_EXCEPTION) {
php_error_docref(NULL, E_WARNING, "%s", ZSTR_VAL(message));
php_error_docref(NULL, E_WARNING, "%pS", message);
} else {
zval ex, info;
zend_class_entry *pdo_ex = php_pdo_get_exception();
Expand Down Expand Up @@ -177,7 +177,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt) /* {{{ */
}

if (dbh->error_mode == PDO_ERRMODE_WARNING) {
php_error_docref(NULL, E_WARNING, "%s", ZSTR_VAL(message));
php_error_docref(NULL, E_WARNING, "%pS", message);
} else if (EG(exception) == NULL) {
zval ex;
zend_class_entry *pdo_ex = php_pdo_get_exception();
Expand Down Expand Up @@ -238,12 +238,12 @@ static bool create_driver_specific_pdo_object(pdo_driver_t *driver, zend_class_e
if (ce_based_on_driver_name) {
if (!instanceof_function(ce_based_on_called_object, ce_based_on_driver_name)) {
zend_throw_exception_ex(pdo_exception_ce, 0,
"%s::%s() cannot be used for connecting to the \"%s\" driver, "
"either call %s::%s() or PDO::%s() instead",
ZSTR_VAL(called_scope->name),
"%pS::%s() cannot be used for connecting to the \"%s\" driver, "
"either call %pS::%s() or PDO::%s() instead",
called_scope->name,
new_zval_object ? "connect" : "__construct",
driver->driver_name,
ZSTR_VAL(ce_based_on_driver_name->name),
ce_based_on_driver_name->name,
new_zval_object ? "connect" : "__construct",
new_zval_object ? "connect" : "__construct"
);
Expand All @@ -257,9 +257,9 @@ static bool create_driver_specific_pdo_object(pdo_driver_t *driver, zend_class_e
return true;
} else {
zend_throw_exception_ex(pdo_exception_ce, 0,
"%s::%s() cannot be used for connecting to an unknown driver, "
"%pS::%s() cannot be used for connecting to an unknown driver, "
"call PDO::%s() instead",
ZSTR_VAL(called_scope->name),
called_scope->name,
new_zval_object ? "connect" : "__construct",
new_zval_object ? "connect" : "__construct"
);
Expand All @@ -276,12 +276,12 @@ static bool create_driver_specific_pdo_object(pdo_driver_t *driver, zend_class_e
if (called_scope != pdo_dbh_ce) {
/* A driver-specific implementation is instantiated with a wrong driver class */
zend_throw_exception_ex(pdo_exception_ce, 0,
"%s::%s() cannot be used for connecting to the \"%s\" driver, "
"either call %s::%s() or PDO::%s() instead",
ZSTR_VAL(called_scope->name),
"%pS::%s() cannot be used for connecting to the \"%s\" driver, "
"either call %pS::%s() or PDO::%s() instead",
called_scope->name,
new_zval_object ? "connect" : "__construct",
driver->driver_name,
ZSTR_VAL(ce_based_on_driver_name->name),
ce_based_on_driver_name->name,
new_zval_object ? "connect" : "__construct",
new_zval_object ? "connect" : "__construct"
);
Expand Down
44 changes: 22 additions & 22 deletions ext/pdo/pdo_stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#define PHP_STMT_GET_OBJ \
pdo_stmt_t *stmt = Z_PDO_STMT_P(ZEND_THIS); \
if (!stmt->dbh) { \
zend_throw_error(NULL, "%s object is uninitialized", ZSTR_VAL(Z_OBJ(EX(This))->ce->name)); \
zend_throw_error(NULL, "%pS object is uninitialized", Z_OBJ(EX(This))->ce->name); \
RETURN_THROWS(); \
} \

Expand Down Expand Up @@ -302,7 +302,7 @@ static bool really_register_bound_param(struct pdo_bound_param_data *param, pdo_
/* Should this always be an Error? */
char *tmp;
/* TODO Error? */
spprintf(&tmp, 0, "Did not find column name '%s' in the defined columns; it will not be bound", ZSTR_VAL(param->name));
spprintf(&tmp, 0, "Did not find column name '%pS' in the defined columns; it will not be bound", param->name);
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", tmp);
efree(tmp);
}
Expand Down Expand Up @@ -1206,8 +1206,8 @@ PHP_METHOD(PDOStatement, fetchAll)
case PDO_FETCH_FUNC: /* Cannot be a default fetch mode */
if (ZEND_NUM_ARGS() != 2) {
zend_string *func = get_active_function_or_method_name();
zend_argument_count_error("%s() expects exactly 2 argument for PDO::FETCH_FUNC, %d given",
ZSTR_VAL(func), ZEND_NUM_ARGS());
zend_argument_count_error("%pS() expects exactly 2 argument for PDO::FETCH_FUNC, %d given",
func, ZEND_NUM_ARGS());
zend_string_release(func);
RETURN_THROWS();
}
Expand All @@ -1219,8 +1219,8 @@ PHP_METHOD(PDOStatement, fetchAll)
case PDO_FETCH_COLUMN:
if (ZEND_NUM_ARGS() > 2) {
zend_string *func = get_active_function_or_method_name();
zend_argument_count_error("%s() expects at most 2 argument for the fetch mode provided, %d given",
ZSTR_VAL(func), ZEND_NUM_ARGS());
zend_argument_count_error("%pS() expects at most 2 argument for the fetch mode provided, %d given",
func, ZEND_NUM_ARGS());
zend_string_release(func);
RETURN_THROWS();
}
Expand All @@ -1245,8 +1245,8 @@ PHP_METHOD(PDOStatement, fetchAll)
/* No support for PDO_FETCH_INTO which takes 2 args??? */
if (ZEND_NUM_ARGS() > 1) {
zend_string *func = get_active_function_or_method_name();
zend_argument_count_error("%s() expects exactly 1 argument for the fetch mode provided, %d given",
ZSTR_VAL(func), ZEND_NUM_ARGS());
zend_argument_count_error("%pS() expects exactly 1 argument for the fetch mode provided, %d given",
func, ZEND_NUM_ARGS());
zend_string_release(func);
RETURN_THROWS();
}
Expand Down Expand Up @@ -1644,8 +1644,8 @@ bool pdo_stmt_setup_fetch_mode(pdo_stmt_t *stmt, zend_long mode, uint32_t mode_a
case PDO_FETCH_KEY_PAIR:
if (variadic_num_args != 0) {
zend_string *func = get_active_function_or_method_name();
zend_argument_count_error("%s() expects exactly %d arguments for the fetch mode provided, %d given",
ZSTR_VAL(func), mode_arg_num, total_num_args);
zend_argument_count_error("%pS() expects exactly %d arguments for the fetch mode provided, %d given",
func, mode_arg_num, total_num_args);
zend_string_release(func);
return false;
}
Expand All @@ -1654,8 +1654,8 @@ bool pdo_stmt_setup_fetch_mode(pdo_stmt_t *stmt, zend_long mode, uint32_t mode_a
case PDO_FETCH_COLUMN:
if (variadic_num_args != 1) {
zend_string *func = get_active_function_or_method_name();
zend_argument_count_error("%s() expects exactly %d arguments for the fetch mode provided, %d given",
ZSTR_VAL(func), arg1_arg_num, total_num_args);
zend_argument_count_error("%pS() expects exactly %d arguments for the fetch mode provided, %d given",
func, arg1_arg_num, total_num_args);
zend_string_release(func);
return false;
}
Expand All @@ -1675,25 +1675,25 @@ bool pdo_stmt_setup_fetch_mode(pdo_stmt_t *stmt, zend_long mode, uint32_t mode_a
if ((flags & PDO_FETCH_CLASSTYPE) == PDO_FETCH_CLASSTYPE) {
if (variadic_num_args != 0) {
zend_string *func = get_active_function_or_method_name();
zend_argument_count_error("%s() expects exactly %d arguments for the fetch mode provided, %d given",
ZSTR_VAL(func), mode_arg_num, total_num_args);
zend_argument_count_error("%pS() expects exactly %d arguments for the fetch mode provided, %d given",
func, mode_arg_num, total_num_args);
zend_string_release(func);
return false;
}
} else {
zend_class_entry *cep;
if (variadic_num_args == 0) {
zend_string *func = get_active_function_or_method_name();
zend_argument_count_error("%s() expects at least %d arguments for the fetch mode provided, %d given",
ZSTR_VAL(func), arg1_arg_num, total_num_args);
zend_argument_count_error("%pS() expects at least %d arguments for the fetch mode provided, %d given",
func, arg1_arg_num, total_num_args);
zend_string_release(func);
return false;
}
/* constructor_arguments can be null/not passed */
if (variadic_num_args > 2) {
zend_string *func = get_active_function_or_method_name();
zend_argument_count_error("%s() expects at most %d arguments for the fetch mode provided, %d given",
ZSTR_VAL(func), constructor_arg_num, total_num_args);
zend_argument_count_error("%pS() expects at most %d arguments for the fetch mode provided, %d given",
func, constructor_arg_num, total_num_args);
zend_string_release(func);
return false;
}
Expand Down Expand Up @@ -1729,8 +1729,8 @@ bool pdo_stmt_setup_fetch_mode(pdo_stmt_t *stmt, zend_long mode, uint32_t mode_a
case PDO_FETCH_INTO:
if (total_num_args != arg1_arg_num) {
zend_string *func = get_active_function_or_method_name();
zend_argument_count_error("%s() expects exactly %d arguments for the fetch mode provided, %d given",
ZSTR_VAL(func), arg1_arg_num, total_num_args);
zend_argument_count_error("%pS() expects exactly %d arguments for the fetch mode provided, %d given",
func, arg1_arg_num, total_num_args);
zend_string_release(func);
return false;
}
Expand Down Expand Up @@ -2154,7 +2154,7 @@ zend_object_iterator *pdo_stmt_iter_get(zend_class_entry *ce, zval *object, int

pdo_stmt_t *stmt = Z_PDO_STMT_P(object);
if (!stmt->dbh) {
zend_throw_error(NULL, "%s object is uninitialized", ZSTR_VAL(ce->name));
zend_throw_error(NULL, "%pS object is uninitialized", ce->name);
return NULL;
}

Expand Down Expand Up @@ -2220,7 +2220,7 @@ static zval *row_prop_read(zend_object *object, zend_string *name, int type, voi
// if (is_numeric) {
// zend_value_error("Invalid column index");
// } else {
// zend_throw_error(NULL, "No column named \"%s\" exists", ZSTR_VAL(name));
// zend_throw_error(NULL, "No column named \"%pS\" exists", name);
// }
//}
//return &EG(uninitialized_zval);
Expand Down
2 changes: 1 addition & 1 deletion ext/pdo/php_pdo.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static inline void pdo_declare_deprecated_class_constant_long(
#define PDO_CONSTRUCT_CHECK_COND dbh->driver
#define PDO_CONSTRUCT_CHECK_FAIL() \
{ \
zend_throw_error(NULL, "%s object is uninitialized", ZSTR_VAL(Z_OBJ(EX(This))->ce->name)); \
zend_throw_error(NULL, "%pS object is uninitialized", Z_OBJ(EX(This))->ce->name); \
} \

#define PDO_CONSTRUCT_CHECK \
Expand Down
Loading