Skip to content

ext/pgsql: Stop using useless convert_to_boolean() API #18683

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 1 commit into from
May 29, 2025
Merged
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
14 changes: 9 additions & 5 deletions ext/pgsql/pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -3879,7 +3879,12 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
switch(entry_type) {
case PHP_PG_ASYNC_IS_BUSY:
PQconsumeInput(pgsql);
RETVAL_LONG(PQisBusy(pgsql));
/* PQisBusy
* Returns 1 if a command is busy, that is, PQgetResult would block waiting for input.
* A 0 return indicates that PQgetResult can be called with assurance of not blocking.
* https://www.postgresql.org/docs/current/libpq-async.html#LIBPQ-PQISBUSY
*/
RETVAL_BOOL(PQisBusy(pgsql));
break;
case PHP_PG_ASYNC_REQUEST_CANCEL: {
PGcancel *c;
Expand All @@ -3893,7 +3898,8 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
* errbuf must be a char array of size errbufsize (the recommended size is 256 bytes).
* https://www.postgresql.org/docs/current/libpq-cancel.html#LIBPQ-PQCANCEL
*/
RETVAL_LONG((rc = PQcancel(c, err, sizeof(err))));
rc = PQcancel(c, err, sizeof(err));
RETVAL_BOOL(rc);
if (rc == 0) {
zend_error(E_WARNING, "cannot cancel the query: %s", err);
}
Expand All @@ -3908,7 +3914,6 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
if (PQsetnonblocking(pgsql, 0)) {
php_error_docref(NULL, E_NOTICE, "Cannot set connection to blocking mode");
}
convert_to_boolean(return_value);
}
/* }}} */

Expand Down Expand Up @@ -4929,8 +4934,7 @@ PHP_PGSQL_API zend_result php_pgsql_convert(PGconn *pg_link, const zend_string *
break; /* break out for() */
}

convert_to_boolean(is_enum);
if (Z_TYPE_P(is_enum) == IS_TRUE) {
if (zval_is_true(is_enum)) {
/* enums need to be treated like strings */
data_type = PG_TEXT;
} else {
Expand Down