You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What exactly do you mean by this. Could you be very specific please? Do you mean the name of the file, the names of the variables, the values of the variables? What is the use case for that?
I see benefits of this in using .env file as a simple config file when you need to just set 2 or 3 variables before executing of the program, not for service/db connectiom , but for inner logic.
I wrote the simple data cruncher for my accounting raw data, that gives me nice reports and make some http queries. It's plain php, cli-based, no frameworks, and need a few settings tuned before executing.
Like this, for example:
ДатаЗакрытияРасчетногоПериода='2022-04-01T00:00'
Translation for this would be like "Closing Date of the Settlement Period", and I don't even sure that I translated it correctly. Purpose of the variable is not obvious from it's name. Maybe the proper way would be to create another 'config.php' file and stores everything in that, why not. But we already have '.env' file that works as config-storage.
Of course nothing is stop me from calling it "ClosingDate", but I'm just curious is it possible to name variables in Unicode.
Python dotenv (https://pypi.org/project/python-dotenv/) works with non-ASCII variable names.
Usecase is pretty obvious as many government contracts demand things to be in their native language. As much as we might dislike mixing languages (PHP itself using english keywords), it may very well be a requirement. PHP itself doesn't have any issues with unicode in variable, class names etc. so I see no reason why not to permit it.
Activity
GrahamCampbell commentedon May 15, 2022
What exactly do you mean by this. Could you be very specific please? Do you mean the name of the file, the names of the variables, the values of the variables? What is the use case for that?
drmnk commentedon May 16, 2022
I'm sorry. I mean the names of the variables.
I see benefits of this in using .env file as a simple config file when you need to just set 2 or 3 variables before executing of the program, not for service/db connectiom , but for inner logic.
I wrote the simple data cruncher for my accounting raw data, that gives me nice reports and make some http queries. It's plain php, cli-based, no frameworks, and need a few settings tuned before executing.
Like this, for example:
Translation for this would be like "Closing Date of the Settlement Period", and I don't even sure that I translated it correctly. Purpose of the variable is not obvious from it's name. Maybe the proper way would be to create another 'config.php' file and stores everything in that, why not. But we already have '.env' file that works as config-storage.
Of course nothing is stop me from calling it "ClosingDate", but I'm just curious is it possible to name variables in Unicode.
Python dotenv (https://pypi.org/project/python-dotenv/) works with non-ASCII variable names.
Sorry if my question seems weird to you.
aidabeorn commentedon Oct 6, 2022
To answer your question, as I tried to figure out why it would work, there seems to be a test case to explicitly not permit this:
https://github.com/vlucas/phpdotenv/blob/master/tests/Dotenv/Parser/EntryParserTest.php#L142-L146
The commit doesn't have any justification, so I'm curious @GrahamCampbell what you got to say?
Usecase is pretty obvious as many government contracts demand things to be in their native language. As much as we might dislike mixing languages (PHP itself using english keywords), it may very well be a requirement. PHP itself doesn't have any issues with unicode in variable, class names etc. so I see no reason why not to permit it.
GrahamCampbell commentedon Oct 16, 2022
Fixed in v5.5.0.