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

Handle constants from .dist #106

Open
fullmoonissue opened this issue Dec 19, 2016 · 8 comments · May be fixed by #127
Open

Handle constants from .dist #106

fullmoonissue opened this issue Dec 19, 2016 · 8 comments · May be fixed by #127

Comments

@fullmoonissue
Copy link

I have a use case where the mcrypt cipher and mode are stored into the .dist file.

parameters:
    cipher: !php/const:MCRYPT_RIJNDAEL_128
    mode: !php/const:MCRYPT_MODE_CBC

After the build of the parameters.yml file, these two keys are set to null.

I can submit a PR to correct that case but I just wanted to know your opinion about this issue.

Regards,

@rrajkomar
Copy link

This bug was declared in 2016.. We're in 2018 and the issue is still there.
Please answer so that this can be fixed asap.

@xabbuh
Copy link

xabbuh commented May 2, 2018

I don't think this can be fixed easily. The YAML parser will replace the constant with its actual value at runtime, so the dumper will only be able to dump this value but not the constant.

@rrajkomar
Copy link

rrajkomar commented May 2, 2018

Actually no, it should an easy fix .
In case the parameter value starts with "!php/const" the whole parameter should be simply be copied to the parameters.yml file and not evaluated.
Evaluation is the job of the application. Simplest way to verify that is to manually copy the value from parameters.yml.dist to parameters.yml and, as long as the value is correct, the application will be able to resolve the value on its own.

@EntranceJew EntranceJew linked a pull request Jul 25, 2018 that will close this issue
@EntranceJew
Copy link

EntranceJew commented Jul 26, 2018

@rrajkomar was correct, it was an easy fix, it just needed an argument to tell it to do so

edit: but this ticket is so old that @fullmoonissue will not be able to use !php/const:MCRYPT_MODE_CBC you will most likely need !php/const MCRYPT_MODE_CBC because the colon notation is depreciated

@fullmoonissue
Copy link
Author

Thank you @rrajkomar and @EntranceJew for taking care of this forgotten issue.

In fact, @EntranceJew your PR was what I wanted to submit (the addition of Yaml::PARSE_CONSTANT and the related tests).

But as @xabbuh mentioned, it resolves the value at runtime and the constant name is not preserved (which will fix my initial issue by the way).

Two years have passed, the DotEnv Component was released and mcrypt was deprecated (even removed in php 7.2) so my issue is become obsolete (for my specific concern).

I let @xabbuh and @stof decide about these issue.

Good bye everyone and wishing to all of you the best.

Kind regards,

@chaouchAbderraouf
Copy link

Hello, i encounter the same problem , is there a future fix for that ?
Thanks

@TiS
Copy link

TiS commented Feb 21, 2019

+1 for this one and proposed PR

@Oliboy50
Copy link

Oliboy50 commented May 7, 2020

@xabbuh I understand your concern about replacing the constant with its actual value instead of keeping the constant... but I think it would still be a lot better than replacing it with null 😄

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

Successfully merging a pull request may close this issue.

7 participants