Skip to content

Minor PDO conditions cleanup #13584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 4, 2024
Merged
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
8 changes: 3 additions & 5 deletions ext/pdo/pdo_dbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, pdo_error_type sqlst
char *message = NULL;
const char *msg;

if (dbh && dbh->error_mode == PDO_ERRMODE_SILENT) {
if (dbh->error_mode == PDO_ERRMODE_SILENT) {
#if 0
/* BUG: if user is running in silent mode and hits an error at the driver level
* when they use the PDO methods to call up the error information, they may
Expand Down Expand Up @@ -134,7 +134,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt) /* {{{ */
zend_string *message = NULL;
zval info;

if (dbh == NULL || dbh->error_mode == PDO_ERRMODE_SILENT) {
if (dbh->error_mode == PDO_ERRMODE_SILENT) {
return;
}

Expand Down Expand Up @@ -197,9 +197,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt) /* {{{ */
zval_ptr_dtor(&info);
}

if (message) {
zend_string_release_ex(message, 0);
}
zend_string_release_ex(message, false);

if (supp) {
efree(supp);
Expand Down
7 changes: 1 addition & 6 deletions ext/pdo/pdo_stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ static void do_fetch_opt_finish(pdo_stmt_t *stmt, int free_ctor_agrs) /* {{{ */
/* }}} */

/* perform a fetch.
* If return_value is not null, store values into it according to HOW. */
* Stores values into return_value according to HOW. */
static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type how, enum pdo_fetch_orientation ori, zend_long offset, zval *return_all) /* {{{ */
{
int flags, idx, old_arg_count = 0;
Expand Down Expand Up @@ -744,11 +744,6 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
colno = stmt->fetch.column;
}

/* If no return value we are done */
if (!return_value) {
return true;
}

if (how == PDO_FETCH_LAZY) {
get_lazy_object(stmt, return_value);
return 1;
Expand Down