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

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

Comments

Projects
None yet
3 participants
@dgro

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 from handling of default parameters broken to Container::call() ignores parameter's default value Sep 6, 2015

@mnapoli mnapoli closed this in 47aa5bb Sep 6, 2015

@mnapoli

This comment has been minimized.

Show comment
Hide comment
@mnapoli

mnapoli Sep 6, 2015

Member

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

Member

mnapoli commented Sep 6, 2015

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

@jdreesen

This comment has been minimized.

Show comment
Hide comment
@jdreesen

jdreesen Sep 6, 2015

Contributor

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

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

This comment has been minimized.

Show comment
Hide comment
@mnapoli

mnapoli Sep 6, 2015

Member

@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.

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

This comment has been minimized.

Show comment
Hide comment
@jdreesen

jdreesen Sep 6, 2015

Contributor

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! :)

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