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

get() throws ConfigurationException when default is passed as null #2545

Closed
staabm opened this issue May 12, 2021 · 2 comments · Fixed by #2560
Closed

get() throws ConfigurationException when default is passed as null #2545

staabm opened this issue May 12, 2021 · 2 comments · Fixed by #2560

Comments

@staabm
Copy link
Contributor

staabm commented May 12, 2021

I didn't expect this code would throw a ConfigurationException: Configuration parameter project_mattermost_hook does not exist error - but just return the null default-value which was passed in.

$mattermostHook = get('project_mattermost_hook', null);
  • Deployer version: 6.8.0
  • Deployment OS: ubuntu20 lts
@Schrank
Copy link
Contributor

Schrank commented May 12, 2021

get checks if the value is null if yes, it throws an exception. I had the same problem already with #2525

Easiest fix is to return false. Hope this works in your case as well. If it doesn't work, lets think about how to change it (your code or deployer), but:

I think it is good to throw an exception, so it is easier to find undefined configurations.

Feel free to comment, if needed I'll reopen. Good luck!

@Schrank Schrank closed this as completed May 12, 2021
@staabm
Copy link
Contributor Author

staabm commented May 12, 2021

I would expect deployer to use e.g. https://www.php.net/func_num_args or similar to check whether there was actually a default given from the outside or whether there wasn't

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.

2 participants