Repository navigation
fix(config): coerce .env values to numbers only when they are plain integers - #4606
Merged
Merged
Conversation
…ntegers loadEnvFile() converted any isNumeric() value without a "." through val(), so 1e3 became 1 and 007 became 7. It now converts only values matching ^-?(0|[1-9][0-9]*)$; 007, 1e3 and +5 stay strings, while 0, 42 and -5 still become numbers. A value that is a single quote character no longer reaches mid() with a negative length: quotes are stripped only when the value has at least two characters. The same change is applied to all four copies of the parser (this repo's public/Application.cfc, the wheels new template, and the two examples). Specs pin the edge values and guard that every copy carries the new check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Peter Amiri <peter@alurium.com>
Contributor
Wheels Test Results7 469 tests 7 320 ✅ 2m 27s ⏱️ Results for commit 7c4f47c. |
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
loadEnvFile()turned everyisNumeric()value without a.into a number withval(). That gave wrong values:1e3became1, becauseval()reads only the leading digits;007became7.A value that was a single quote character also reached
mid(value, 2, -1).Now:
^-?(0|[1-9][0-9]*)$.007,1e3and+5stay strings;0,42and-5still become numbers.'or"survives as itself and parsing continues on the next line.The same change is in all four copies of the parser:
public/Application.cfc;wheels newtemplate;examples/starter-app;examples/tweet.Existing apps keep the old parser in their own
public/Application.cfcuntil they copy the change; the changelog fragment says so.Not changed: the three legacy
cli/src/commands/wheels/*settings parsers. They parsesettings.cfmset()calls, not.envlines, and don't have the lone-quote crash. They do over-convert numbers, including decimals; that's a separate follow-up.Testing
edge-values.envfixture with a spec block for007,1e3,+5,-5, a lone single quote and a lone double quote, plus a key after them to prove parsing continues;Application.cfccopy carries the integer-only check and no longer the old one..envspecs: unchanged, and passing.directory=wheels.tests.specs.globalon SQLite (45 bundles each;EnvFileParsingSpecall passing):The demo app boots, and
/returns 200 on Lucee 7. Adobe 2025 couldn't start locally (a corrupted cached engine download). It's being covered by a compat-matrix dispatch on this branch.🤖 Generated with Claude Code