diff options
| author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-10-12 19:18:03 +0200 |
|---|---|---|
| committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-10-12 23:10:13 +0200 |
| commit | 8d4774a2df4e16679c9176e2b6edecc94283af6d (patch) | |
| tree | 055eb6ee3fa5c45d0240a4f8673b82db5f5fd628 /ext/odbc | |
| parent | 1c596ff1463a187d0fe135de251fb139b63858bd (diff) | |
| download | php-git-8d4774a2df4e16679c9176e2b6edecc94283af6d.tar.gz | |
Change parameters types from int to bool
These are typical boolean parameters, so we shouldn't advertize them as
integers. For the `$reverse` parameter that even fixes expectations,
because the `reverse` member is a bitfield of 1 bit, so assigning any
even integer would not set it.
Closes GH-6328.
Diffstat (limited to 'ext/odbc')
| -rw-r--r-- | ext/odbc/odbc.stub.php | 2 | ||||
| -rw-r--r-- | ext/odbc/odbc_arginfo.h | 4 | ||||
| -rw-r--r-- | ext/odbc/php_odbc.c | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/ext/odbc/odbc.stub.php b/ext/odbc/odbc.stub.php index 667d5e88b7..a20e22fa32 100644 --- a/ext/odbc/odbc.stub.php +++ b/ext/odbc/odbc.stub.php @@ -108,7 +108,7 @@ function odbc_field_scale($result_id, int $field_number): int|false {} function odbc_field_num($result_id, string $field_name): int|false {} /** @param resource $connection_id */ -function odbc_autocommit($connection_id, int $onoff = 0): int|bool {} +function odbc_autocommit($connection_id, bool $onoff = false): int|bool {} /** @param resource $connection_id */ function odbc_commit($connection_id): bool {} diff --git a/ext/odbc/odbc_arginfo.h b/ext/odbc/odbc_arginfo.h index ad2fbf48b0..361c93c5eb 100644 --- a/ext/odbc/odbc_arginfo.h +++ b/ext/odbc/odbc_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 53069f42e460cfea8e2daf499277f6ceb9c760f7 */ + * Stub hash: bdf94bcc0fd30c5b08aa80ecc6c2ff8ca6de3e62 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_close_all, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() @@ -126,7 +126,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_autocommit, 0, 1, MAY_BE_LONG|MAY_BE_BOOL) ZEND_ARG_INFO(0, connection_id) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, onoff, IS_LONG, 0, "0") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, onoff, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_commit, 0, 1, _IS_BOOL, 0) diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index c24e57228f..3e4efb7380 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -2521,9 +2521,9 @@ PHP_FUNCTION(odbc_autocommit) odbc_connection *conn; RETCODE rc; zval *pv_conn; - zend_long pv_onoff = 0; + zend_bool pv_onoff = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &pv_conn, &pv_onoff) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|b", &pv_conn, &pv_onoff) == FAILURE) { RETURN_THROWS(); } @@ -2532,7 +2532,7 @@ PHP_FUNCTION(odbc_autocommit) } if (ZEND_NUM_ARGS() > 1) { - rc = SQLSetConnectOption(conn->hdbc, SQL_AUTOCOMMIT, (pv_onoff) ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF); + rc = SQLSetConnectOption(conn->hdbc, SQL_AUTOCOMMIT, pv_onoff ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { odbc_sql_error(conn, SQL_NULL_HSTMT, "Set autocommit"); RETURN_FALSE; |
