FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

lib: fix misleading argument of validateUint32 by tniessen · Pull Request #53307 · nodejs/node · GitHub

/ node Public

lib: fix misleading argument of validateUint32 - #53307

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
tniessen:lib-validateuint32-positive
Jun 5, 2024
Merged

lib: fix misleading argument of validateUint32#53307
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
tniessen:lib-validateuint32-positive

Conversation

tniessen commented Jun 3, 2024

Copy link
Copy Markdown
Member

The type of the argument positive was declared as boolean|number, which is misleading because the function treats it as a boolean only. Some call sites even passed numbers, specifically, either 0 or 1, which happen to work as expected because they are interpreted as false and true, respectively. However, passing 2 would silently lead to unexpected behavior. Thus, strictly make the argument a boolean.

The type of the argument `positive` was declared as `boolean|number`,
which is misleading because the function treats it as a boolean only.
Some call sites even passed numbers, specifically, either `0` or `1`,
which happen to work as expected because they are interpreted as `false`
and `true`, respectively. However, passing `2` would silently lead to
unexpected behavior. Thus, strictly make the argument a boolean.
tniessen added the lib / src Issues and PRs related to general changes in the lib or src directory. label Jun 3, 2024

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Jun 3, 2024
tniessen removed the test_runner Issues and PRs related to the test runner subsystem. label Jun 3, 2024
tniessen added author ready PRs that have at least one approval, no outstanding review comments, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jun 3, 2024
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 3, 2024

Copy link
Copy Markdown
Collaborator

H4ad added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 5, 2024
nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 5, 2024
nodejs-github-bot merged commit 5469d04 into nodejs:main Jun 5, 2024

Copy link
Copy Markdown
Collaborator

Landed in 5469d04

RafaelGSS pushed a commit that referenced this pull request Jun 7, 2024
The type of the argument `positive` was declared as `boolean|number`,
which is misleading because the function treats it as a boolean only.
Some call sites even passed numbers, specifically, either `0` or `1`,
which happen to work as expected because they are interpreted as `false`
and `true`, respectively. However, passing `2` would silently lead to
unexpected behavior. Thus, strictly make the argument a boolean.

PR-URL: #53307
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
RafaelGSS mentioned this pull request Jun 7, 2024
soophoo pushed a commit to soophoo/node that referenced this pull request Jun 20, 2024
The type of the argument `positive` was declared as `boolean|number`,
which is misleading because the function treats it as a boolean only.
Some call sites even passed numbers, specifically, either `0` or `1`,
which happen to work as expected because they are interpreted as `false`
and `true`, respectively. However, passing `2` would silently lead to
unexpected behavior. Thus, strictly make the argument a boolean.

PR-URL: nodejs#53307
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
marco-ippolito pushed a commit that referenced this pull request Jul 19, 2024
The type of the argument `positive` was declared as `boolean|number`,
which is misleading because the function treats it as a boolean only.
Some call sites even passed numbers, specifically, either `0` or `1`,
which happen to work as expected because they are interpreted as `false`
and `true`, respectively. However, passing `2` would silently lead to
unexpected behavior. Thus, strictly make the argument a boolean.

PR-URL: #53307
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants


Back | FazBrowse Home | New Git URL