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

Container::call() ignores parameter's default value #318

Closed
dgro opened this issue Sep 6, 2015 · 4 comments
Closed

Container::call() ignores parameter's default value #318

dgro opened this issue Sep 6, 2015 · 4 comments
Labels
Milestone

Comments

@dgro
Copy link

dgro commented Sep 6, 2015

<?php
use DI\ContainerBuilder;

require 'vendor/autoload.php';

$builder = new ContainerBuilder();
$container = $builder->build();

$test = function($optional = 'default') {
    echo $optional;
};

$container->call($test);

output version 4.4.10: default

output version 5: Fatal error: Uncaught exception 'Invoker\Exception\NotEnoughParametersException' with message 'Unable to invoke the callable because no value was given for parameter 1 ($optional)'

@mnapoli mnapoli added the bug label Sep 6, 2015
@mnapoli mnapoli added this to the 5.1 milestone Sep 6, 2015
@mnapoli mnapoli changed the title handling of default parameters broken Container::call() ignores parameter's default value Sep 6, 2015
@mnapoli mnapoli closed this as completed in 47aa5bb Sep 6, 2015
@mnapoli
Copy link
Member

mnapoli commented Sep 6, 2015

Thank you I've pushed a fix which will be in the next release (5.1.0).

@jdreesen
Copy link
Contributor

jdreesen commented Sep 6, 2015

I just wanted to create a pull request for this, but I was a few seconds too slow :)

@mnapoli
Copy link
Member

mnapoli commented Sep 6, 2015

@jdreesen haha ;) By the way I'll be releasing a 5.1.0 beta tonight, and release next week. If you have PRs or things you want to include in that release now is the time, or let me know if you want that we delay a little bit more. I'm working on the changelog and news entry right now.

@jdreesen
Copy link
Contributor

jdreesen commented Sep 6, 2015

Thx, but I have nothing so far. I just started to take a deeper look into this project and I like it very much by now! :)

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

No branches or pull requests

3 participants