Title: A "hybrid" bareword command argument that is parsed as a number unexpectedly behaves like a string with -f (format operator) · Issue #17199 · PowerShell/PowerShell · GitHub
Open Graph Title: A "hybrid" bareword command argument that is parsed as a number unexpectedly behaves like a string with -f (format operator) · Issue #17199 · PowerShell/PowerShell
X Title: A "hybrid" bareword command argument that is parsed as a number unexpectedly behaves like a string with -f (format operator) · Issue #17199 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/17199
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"A \"hybrid\" bareword command argument that is parsed as a number unexpectedly behaves like a string with -f (format operator)","articleBody":"### Prerequisites\n\n- [X] Write a descriptive title.\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\n- [X] Search the existing issues.\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\n\n### Steps to reproduce\n\nPassing a bareword argument to a parameter that isn't type-constrained is parsed as a number if it looks like one.\r\n\r\nThe resulting value self-identifies _as a number_ and _mostly_ acts as such, but it is wrapped in an invisible `[psobject]` instance in which the original string representation is cached.\r\n\r\nIn the context of `-f`, this string representation surfaces unexpectedly, meaning that the value is unexpectedly not treated as a number:\r\n\r\n```powershell\r\n\u0026 { param($p) $p.GetType().FullName; '{0:N2}' -f $p } 0x1a\r\n```\r\n\n\n### Expected behavior\n\n```console\nSystem.Int32\r\n26.00\n```\n\n\n### Actual behavior\n\n```console\nSystem.Int32\r\n0x1a\n```\n\n\n### Error details\n\n_No response_\n\n### Environment data\n\n```powershell\nPowerShell Core 7.3.0-preview.3\n```\n\n\n### Visuals\n\n_No response_","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2022-04-26T19:58:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/17199/PowerShell/issues/17199"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e1248382-31c6-24de-853d-43b7915b0912 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D8D8:2C555C:C94F80:1096A26:6A5BB535 |
| html-safe-nonce | 593c27980cba52b248be9af34575a97fa7fef9c9711c4a0356d0c6dfd0e6b89e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOEQ4OjJDNTU1QzpDOTRGODA6MTA5NkEyNjo2QTVCQjUzNSIsInZpc2l0b3JfaWQiOiI4ODE0NjM1MTY2NjA4MzczMDQ1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8e807d868da8cae45d13970b74f47083c280918b82f5fc9a1bc07b7ef390f6c6 |
| hovercard-subject-tag | issue:1216413958 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/17199/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3dde2ef2cb3eb2db51620147f7ae6b5fba5d4fb2298a56da6e0e5729386bbe09/PowerShell/PowerShell/issues/17199 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3dde2ef2cb3eb2db51620147f7ae6b5fba5d4fb2298a56da6e0e5729386bbe09/PowerShell/PowerShell/issues/17199 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width