Skip to content
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

Format String Grabs Latest Local String Variable when Erroring out due to insufficient arguments. #85498

Open
EroAxe opened this issue Nov 29, 2023 · 0 comments

Comments

@EroAxe
Copy link

EroAxe commented Nov 29, 2023

Godot version

v4.2.rc2.official [1ba920f]

System information

Windows 10

Issue description

When doing a format string like so "string % [arg1, arg2]" if you have a variable local to the function that is either equal to "str([something])" or a valid format string with it's arguments in an array ex. "testing %s" % ["stuff"] it will steal the most recent one for the erroring format string.

Small note, it seems to grab the str variable (the stolen one that comes first) without any of the logic applied to it. Ex. "str("stuff and things").uri_encode() gets stolen as just "stuff and things" rather than applying the uri_encode.

Steps to reproduce

  • Create a function
  • Add a variable that equals to "str()" or a variable equal to a valid Format String with arguments wrapped in an Array
  • Set a variable after the above String Variable to a Format String with insufficient arguments with the arguments wrapped in an Array (ex. "stuff %s %s" % ["things"]
  • Check the second variable, print, breakpoint whatever.

Repro Project Steps:

  • Run Main Scene
  • Click Scene (just runs the function
  • Check output
  • Repeat with different lines in Format_string_test.test_format uncommented/or commented.

Minimal reproduction project

Format String Access Bug.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants