mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Minor PDO conditions cleanup (#13584)
* Get rid of inverted NULL checks As the dbh pointer is already used in address computation, the NULL checks is redundant. Looking at the callers there are no cases where this can be passed as NULL. * Message can't be NULL here * Remove null check for return_value As one of the branches dereferences return_value unconditionally, the NULL check is dubious. In fact, looking at the callers we see that return_value can never be NULL. So remove the check and fix the comment.
This commit is contained in:
parent
3f05418e8b
commit
ad1dfa35f2
2 changed files with 4 additions and 11 deletions
|
@ -71,7 +71,7 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, pdo_error_type sqlst
|
||||||
char *message = NULL;
|
char *message = NULL;
|
||||||
const char *msg;
|
const char *msg;
|
||||||
|
|
||||||
if (dbh && dbh->error_mode == PDO_ERRMODE_SILENT) {
|
if (dbh->error_mode == PDO_ERRMODE_SILENT) {
|
||||||
#if 0
|
#if 0
|
||||||
/* BUG: if user is running in silent mode and hits an error at the driver level
|
/* 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
|
* when they use the PDO methods to call up the error information, they may
|
||||||
|
@ -134,7 +134,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt) /* {{{ */
|
||||||
zend_string *message = NULL;
|
zend_string *message = NULL;
|
||||||
zval info;
|
zval info;
|
||||||
|
|
||||||
if (dbh == NULL || dbh->error_mode == PDO_ERRMODE_SILENT) {
|
if (dbh->error_mode == PDO_ERRMODE_SILENT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,9 +197,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt) /* {{{ */
|
||||||
zval_ptr_dtor(&info);
|
zval_ptr_dtor(&info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message) {
|
zend_string_release_ex(message, false);
|
||||||
zend_string_release_ex(message, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (supp) {
|
if (supp) {
|
||||||
efree(supp);
|
efree(supp);
|
||||||
|
|
|
@ -714,7 +714,7 @@ static void do_fetch_opt_finish(pdo_stmt_t *stmt, int free_ctor_agrs) /* {{{ */
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* perform a fetch.
|
/* 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) /* {{{ */
|
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;
|
int flags, idx, old_arg_count = 0;
|
||||||
|
@ -744,11 +744,6 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
|
||||||
colno = stmt->fetch.column;
|
colno = stmt->fetch.column;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If no return value we are done */
|
|
||||||
if (!return_value) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (how == PDO_FETCH_LAZY) {
|
if (how == PDO_FETCH_LAZY) {
|
||||||
get_lazy_object(stmt, return_value);
|
get_lazy_object(stmt, return_value);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue