Skip to content

Commit 8d4774a

Browse files
committed
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.
1 parent 1c596ff commit 8d4774a

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

ext/imap/php_imap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2700,14 +2700,15 @@ PHP_FUNCTION(imap_sort)
27002700
{
27012701
zval *streamind;
27022702
zend_string *criteria = NULL, *charset = NULL;
2703-
zend_long sort, rev, flags = 0;
2703+
zend_long sort, flags = 0;
2704+
zend_bool rev;
27042705
pils *imap_le_struct;
27052706
unsigned long *slst, *sl;
27062707
char *search_criteria;
27072708
SORTPGM *mypgm=NIL;
27082709
SEARCHPGM *spg=NIL;
27092710

2710-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll|lS!S!", &streamind, &sort, &rev, &flags, &criteria, &charset) == FAILURE) {
2711+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlb|lS!S!", &streamind, &sort, &rev, &flags, &criteria, &charset) == FAILURE) {
27112712
RETURN_THROWS();
27122713
}
27132714

ext/imap/php_imap.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function imap_setflag_full($imap, string $sequence, string $flag, int $options =
173173
function imap_clearflag_full($imap, string $sequence, string $flag, int $options = 0): bool {}
174174

175175
/** @param resource $imap */
176-
function imap_sort($imap, int $criteria, int $reverse, int $flags = 0, ?string $search_criteria = null, ?string $charset = null): array|false {}
176+
function imap_sort($imap, int $criteria, bool $reverse, int $flags = 0, ?string $search_criteria = null, ?string $charset = null): array|false {}
177177

178178
/** @param resource $imap */
179179
function imap_uid($imap, int $message_num): int|false {}

ext/imap/php_imap_arginfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: c230b35425ab6b707f22158f2e6176c81d4137e9 */
2+
* Stub hash: 326cb0410034aecc702e9397cd88ef91adaa254c */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_open, 0, 0, 3)
55
ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
@@ -207,7 +207,7 @@ ZEND_END_ARG_INFO()
207207
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_sort, 0, 3, MAY_BE_ARRAY|MAY_BE_FALSE)
208208
ZEND_ARG_INFO(0, imap)
209209
ZEND_ARG_TYPE_INFO(0, criteria, IS_LONG, 0)
210-
ZEND_ARG_TYPE_INFO(0, reverse, IS_LONG, 0)
210+
ZEND_ARG_TYPE_INFO(0, reverse, _IS_BOOL, 0)
211211
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
212212
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, search_criteria, IS_STRING, 1, "null")
213213
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, charset, IS_STRING, 1, "null")

ext/odbc/odbc.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function odbc_field_scale($result_id, int $field_number): int|false {}
108108
function odbc_field_num($result_id, string $field_name): int|false {}
109109

110110
/** @param resource $connection_id */
111-
function odbc_autocommit($connection_id, int $onoff = 0): int|bool {}
111+
function odbc_autocommit($connection_id, bool $onoff = false): int|bool {}
112112

113113
/** @param resource $connection_id */
114114
function odbc_commit($connection_id): bool {}

ext/odbc/odbc_arginfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 53069f42e460cfea8e2daf499277f6ceb9c760f7 */
2+
* Stub hash: bdf94bcc0fd30c5b08aa80ecc6c2ff8ca6de3e62 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_close_all, 0, 0, IS_VOID, 0)
55
ZEND_END_ARG_INFO()
@@ -126,7 +126,7 @@ ZEND_END_ARG_INFO()
126126

127127
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_autocommit, 0, 1, MAY_BE_LONG|MAY_BE_BOOL)
128128
ZEND_ARG_INFO(0, connection_id)
129-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, onoff, IS_LONG, 0, "0")
129+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, onoff, _IS_BOOL, 0, "false")
130130
ZEND_END_ARG_INFO()
131131

132132
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_commit, 0, 1, _IS_BOOL, 0)

ext/odbc/php_odbc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2521,9 +2521,9 @@ PHP_FUNCTION(odbc_autocommit)
25212521
odbc_connection *conn;
25222522
RETCODE rc;
25232523
zval *pv_conn;
2524-
zend_long pv_onoff = 0;
2524+
zend_bool pv_onoff = 0;
25252525

2526-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &pv_conn, &pv_onoff) == FAILURE) {
2526+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|b", &pv_conn, &pv_onoff) == FAILURE) {
25272527
RETURN_THROWS();
25282528
}
25292529

@@ -2532,7 +2532,7 @@ PHP_FUNCTION(odbc_autocommit)
25322532
}
25332533

25342534
if (ZEND_NUM_ARGS() > 1) {
2535-
rc = SQLSetConnectOption(conn->hdbc, SQL_AUTOCOMMIT, (pv_onoff) ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF);
2535+
rc = SQLSetConnectOption(conn->hdbc, SQL_AUTOCOMMIT, pv_onoff ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF);
25362536
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
25372537
odbc_sql_error(conn, SQL_NULL_HSTMT, "Set autocommit");
25382538
RETURN_FALSE;

0 commit comments

Comments
 (0)