Handle constants from .dist
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,
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.
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.
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.
@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
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,
Hello, i encounter the same problem , is there a future fix for that ? Thanks
+1 for this one and proposed PR
@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 😄