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

[4.x]: .env variable normalization of float instead of string results in truncation #15533

Closed
engram-design opened this issue Aug 14, 2024 · 2 comments

Comments

@engram-design
Copy link
Contributor

What happened?

Description

We have an issue where we want to store a Client ID for OAuth for Slack as an .env variable. This looks like: 2833563543.1341693581393.

The problem is that when this is parsed as an .env variable the value is truncated:

// .env
SLACK_CLIENT_ID="2833563543.1341693581393"

// php
App::parseEnv('$SLACK_CLIENT_ID');

// produces
2833563543.1342

It seems this is due to the normalization of variables, and it thinks that this is a float, where it's a string.

Could some more smarts be added to check if this should be an int/float by checking if the length of the source string and the target int/float are the same before assuming things?

Craft CMS version

4.11.1

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@brandonkelly
Copy link
Member

Thanks for reporting that! Fixed for the next Craft 4 and 5 releases.

@brandonkelly
Copy link
Member

Craft 4.11.4 and 5.3.5 are out with that fix.

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