Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

CConsoleCommand: Array to string conversion when displaying help #1996

Closed
dInGd0nG opened this Issue · 6 comments

3 participants

@dInGd0nG

Below command uses anonymous arguments as specified in the definitive guide.

class TestCommand extends CConsoleCommand
{
    public function actionIndex($limit=10, $args=array())
    {
        print_r($args);
    }
}

So when I call the help for this test command
php yiic help test

PHP Error[8]: Array to string conversion
    in file /var/www/yii/framework/console/CConsoleCommand.php at line 313
@samdark
Collaborator

I think you should add array hint in front of $args. Also is there the same error if you're not using print_r?

@dInGd0nG

I used exactly as said in the definitive guide. the problem is ther without print_r . this line is causing problems as the $defaultValue is an array()

Anonymous action parameters wont work if i use an arry hinting

@samdark
Collaborator

Ahh, I see. Yes, that seems to be a bug. You must be used very recent PHP versions.

@samdark samdark was assigned
@cebe
Collaborator

hm... afaik you have to put $args as first param, but didn't check that.

@dInGd0nG dInGd0nG referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@samdark
Collaborator

@dInGd0nG can you send a pull-request?

@samdark samdark closed this issue from a commit
@samdark samdark Fixed #1996: Using yiic help for commands with parameters with array …
…as default value resulted in PHP error with latest PHP versions
0dbccc4
@samdark samdark closed this in 0dbccc4
@samdark
Collaborator

Merged manually with some adjustments. Thanks for working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.